Example #1
0
 /**
  * @param string $type
  * @param string $name
  * @param AvroSchema $schema
  * @param boolean $is_type_from_schemata
  * @param string $default
  * @param string $order
  * @todo Check validity of $default value
  * @todo Check validity of $order value
  */
 public function __construct($name, $schema, $is_type_from_schemata, $has_default, $default, $order = null)
 {
     if (!AvroName::is_well_formed_name($name)) {
         throw new AvroSchemaParseException('Field requires a "name" attribute');
     }
     $this->type = $schema;
     $this->is_type_from_schemata = $is_type_from_schemata;
     $this->name = $name;
     $this->has_default = $has_default;
     if ($this->has_default) {
         $this->default = $default;
     }
     $this->check_order_value($order);
     $this->order = $order;
 }
Example #2
0
 /**
  * @dataProvider name_provider
  */
 function test_name($name, $is_well_formed)
 {
     $this->assertEquals(AvroName::is_well_formed_name($name), $is_well_formed, $name);
 }