FluentDOM\Nodes::__unset PHP Method

__unset() public method

Throws an exception if somebody tries to unset one of the dynamic properties
public __unset ( string $name )
$name string
    public function __unset($name)
    {
        switch ($name) {
            case 'contentType':
            case 'document':
            case 'length':
            case 'xpath':
                throw new \BadMethodCallException(sprintf('Can not unset property %s::$%s', get_class($this), $name));
        }
        throw new \BadMethodCallException(sprintf('Can not unset non existing property %s::$%s', get_class($this), $name));
    }

Usage Example

Example #1
0
 /**
  * Throws an exception if somebody tries to unset one
  * of the dynamic properties
  *
  * @param string $name
  * @throws \BadMethodCallException
  */
 public function __unset($name)
 {
     switch ($name) {
         case 'attr':
         case 'css':
         case 'data':
             throw new \BadMethodCallException(sprintf('Can not unset property %s::$%s', get_class($this), $name));
     }
     parent::__unset($name);
     // @codeCoverageIgnoreStart
 }