public static function create($id, $name, $type)
 {
     $instance = new FieldMetadata();
     assert(is_integer($id));
     assert(is_string($name));
     assert(Type::isValid($type));
     $instance->id = $id;
     $instance->name = $name;
     $instance->type = $type;
     return $instance;
 }
Example #2
0
 public function __construct($type, $callback, $id = null)
 {
     if (!Type::isValid($type)) {
         throw new Exception('Bad event type: ' . $type);
     }
     if (!is_callable($callback)) {
         throw new Exception('Is not callable listener');
     }
     $this->callback = $callback;
     $this->type = $type;
     $this->id = $id;
 }
Example #3
0
 public function testValuesInvalidShouldReturnFalse()
 {
     $this->assertFalse(Type::isValid(0));
     $this->assertFalse(Type::isValid(4));
 }