__get() public method

Virtual properties, read property
public __get ( string $name ) : mixed
$name string
return mixed
Exemplo n.º 1
0
 /**
  * Virtual properties, read property
  *
  * @param string $name
  * @throws \UnexpectedValueException
  * @return mixed
  */
 public function __get($name)
 {
     switch ($name) {
         case 'attr':
             return new Query\Attributes($this);
         case 'css':
             return new Query\Css($this);
         case 'data':
             if ($node = $this->getFirstElement()) {
                 return new Query\Data($node);
             } else {
                 throw new \UnexpectedValueException('UnexpectedValueException: first selected node is no element.');
             }
     }
     return parent::__get($name);
 }