public function add(string $key, string $type, array $options = []) : BaseNode { $child = $this->typeHandler->getType($type); if (isset($options['handler'])) { /** @var InputHandler $handler */ $handler = $options['handler']; $handler->setRootType($type); $handler->define(); $child = $handler->getRoot(); } if (isset($options['required'])) { $child->setRequired($options['required']); } if (isset($options['default'])) { $child->setDefault($options['default']); } if (isset($options['instantiator'])) { $child->setInstantiator($options['instantiator']); } if (isset($options['transformer'])) { $child->setTransformer($options['transformer']); } if (isset($options['constraints'])) { $child->setConstraints($options['constraints']); } if (isset($options['allow_null'])) { $child->setAllowNull($options['allow_null']); } $this->children[$key] = $child; return $child; }
public function add(string $key, string $type, array $options = []) : BaseNode { $child = $this->typeHandler->getType($type); $child->setTypeHandler($this->typeHandler); if (isset($options['required'])) { $child->setRequired($options['required']); } if (isset($options['default'])) { $child->setDefault($options['default']); } if (isset($options['instantiator'])) { $child->setInstantiator($options['instantiator']); } if (isset($options['transformer'])) { $child->setTransformer($options['transformer']); } if (isset($options['constraints'])) { $child->setConstraints($options['constraints']); } $this->children[$key] = $child; return $child; }
public function testIsDetectingConflictWithCaseInsensitive() { $typeHandler = new TypeHandler(); $type = $typeHandler->getType('datetime'); $this->assertInstanceOf(DateTimeNode::class, $type); }
public function setRootType(string $type) { $this->root = $this->typeHandler->getType($type); }