Esempio n. 1
0
 /**
  * Allow read access to "attr" as a dynamic property.
  * Call inherited method for other properties.
  *
  * This allows to get/set xml attributes using array syntax.
  *
  * @see FluentDOM/FluentDOMCore::__get()
  * @param string $name
  * @return mixed
  */
 public function __get($name)
 {
     switch ($name) {
         case 'attr':
             return new FluentDOMAttributes($this);
         case 'data':
             if (count($this->_array) > 0 && $this->_array[0] instanceof DOMElement) {
                 return new FluentDOMData($this->_array[0]);
             } else {
                 throw new UnexpectedValueException('UnexpectedValueException: first selected node is no element.');
             }
     }
     return parent::__get($name);
 }