/** * * @param XmlElemement $parent * @param string $tagName (e.g. ns:taname) * @param array $attributes * @param array $children */ public function __construct($parent, $namespace, $attributes, $children) { $elem = [XmlKey::TAG_NAME_KEY => get_class($this), XmlKey::TAG_ATTRIBUTES_KEY => $attributes, XmlKey::TAG_CHILDREN_KEY => $children]; parent::__construct($elem, $parent); $class = strtolower(get_class($this)); $this->meta->name = substr($class, strrpos($class, '\\') + 1); $this->meta->namespace = $namespace; /* * Object will has attributes as property */ foreach ($this->meta->attributes as $key => $value) { // TODO // $annotations = Annotations::ofProperty($this, $key); // $propertyType = self::SIMPLE_PROPERTY; // foreach ($annotations as $annotation){ // if(get_class($annotation) == 'Annotation\\Standard\\MethodAnnotation'){ // $propertyType = self::METHOD_PROPERTY; // break; // } // if(get_class($annotation) == 'Annotation\\Standard\\BindingAnnotation'){ // $propertyType = self::BINDING_PROPERTY; // break; // } // } $propertyType = self::SIMPLE_PROPERTY; switch ($propertyType) { case self::METHOD_PROPERTY: $val = $this->evaluateZXAsMethod($value, $this); break; case self::BINDING_PROPERTY: $val = $this->bindValue($value, $this); break; case self::SIMPLE_PROPERTY: default: $val = $this->evaluateZX($value, $this); break; } $this->{$key} = $val; unset($val); } $this->meta->attributes = array(); $this->init(); }
protected function preAssembleChildren() { // must reset before filling $this->assembledChildren = []; if (is_array($this->children)) { foreach ($this->children as $child) { if (is_string($child)) { $this->assembledChildren[] = $this->evaluateZX($child); } else { $childElem = new XmlElement($child, $this); $this->assembledChildren[] = $childElem->assemble(); } } } }