/** * Creates a new instance of ObjectSyntax. * * @param array $fields Associative array specifying the fields of the object. * @param string $separator The string that separates items of the array. * @param string $default The default value. */ public function __construct($fields = [], $separator = null, $default = null, $description = '') { if ($separator === null || $separator == '') { $separator = ':'; } $this->fields = $fields; $this->separator = $separator; parent::__construct($default, $description); }
/** * Creates a new instance of ArraySyntax. * * @param Tarsana\Syntax\Syntax $syntax The syntax of each item of the array. * @param string $separator The string that separates items of the array. * @param string $default The default value. */ public function __construct($syntax = null, $separator = null, $default = null, $description = '') { if ($syntax === null) { $syntax = Factory::string(); } if ($separator === null || $separator == '') { $separator = ','; } $this->itemSyntax = $syntax; $this->separator = $separator; parent::__construct($default, $description); }
/** * Creates a new SyntaxSyntax instance. */ public function __construct() { parent::__construct(); $this->arraySeparator(',')->objectSeparator(':')->fieldsSeparator(','); }