/** * @return string */ public function getHierarchicalName() { if ($this->parent === null) { return $this->name; } return $this->parent->getHierarchicalName() . '.' . $this->name; }
/** * @param Config\AbstractPropertyConfig $property * @return array */ private function getPropertyData(Config\AbstractPropertyConfig $property) { if ($property instanceof Config\PropertySetConfig) { $setData = array(); foreach ($property as $subProperty) { $setData[] = $this->getPropertyData($subProperty); } return array('id' => $property->name, 'type' => 'Set', 'label' => $property->getLabel(), 'properties' => $setData); } elseif ($property instanceof Config\PropertyListConfig) { return array('id' => $property->name, 'type' => 'Collection', 'label' => $property->getLabel(), 'properties' => $this->getPropertyData($property->getListItem())); } elseif ($property instanceof Config\PropertyConfig) { $editable = $property->getEditable(); return array('id' => $property->name, 'value' => $editable->getDefaultValue(), 'type' => $editable->getEditorType(), 'label' => $editable->getLabel(), 'description' => $editable->getDescription()) + $editable->getAdditionalParameters(); } else { throw new \UnexpectedValueException(sprintf('Don\'t know what do to with [%s].', get_class($property))); } }
/** * @param AbstractPropertyConfig $item */ public function setListItem(AbstractPropertyConfig $item) { $item->setParent($this); $this->item = $item; }
/** * @param AbstractPropertyConfig $item */ public function addSetItem(AbstractPropertyConfig $item) { $item->setParent($this); $this->items[$item->name] = $item; }
/** * @param string $name * @param Editable $editable */ public function __construct($name, Editable $editable) { parent::__construct($name); $this->editable = $editable; }