public function cloneVar($var, $filter = 0)
    {
        $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
            if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
                // Cloner never dies
                throw new \ErrorException($msg, 0, $type, $file, $line);
            }

            if ($this->prevErrorHandler) {
                return ($this->prevErrorHandler)($type, $msg, $file, $line, $context);
            }

            return false;
        });
        $this->filter = $filter;

        if ($gc = gc_enabled()) {
            gc_disable();
        }
        try {
            return new Data($this->doClone($var));
        } finally {
            if ($gc) {
                gc_enable();
            }
            restore_error_handler();
            $this->prevErrorHandler = null;
        }
    }
public function cloneVar($var, $filter = 0)
    {
        $this->prevErrorHandler = set_error_handler(function ($type, $msg, $file, $line, $context = []) {
            if (E_RECOVERABLE_ERROR === $type || E_USER_ERROR === $type) {
                // Cloner never dies
                throw new \ErrorException($msg, 0, $type, $file, $line);
            }

            if ($this->prevErrorHandler) {
                return ($this->prevErrorHandler)($type, $msg, $file, $line, $context);
            }

            return false;
        });
        $this->filter = $filter;

        if ($gc = gc_enabled()) {
            gc_disable();
        }
        try {
            return new Data($this->doClone($var));
        } finally {
            if ($gc) {
                gc_enable();
            }
            restore_error_handler();
            $this->prevErrorHandler = null;
        }
    }
public function cloneVar ( $ var , $ filter = 0 ) { $ this -> prevErrorHandler = set_error_handler ( function ( $ type , $ msg , $ file , $ line , $ context = [ ] ) { if ( E_RECOVERABLE_ERROR === $ type || E_USER_ERROR === $ type ) { // Cloner never dies throw new \ ErrorException ( $ msg , 0 , $ type , $ file , $ line ) ; } if ( $ this -> prevErrorHandler ) { return ( $ this -> prevErrorHandler ) ( $ type , $ msg , $ file , $ line , $ context ) ; } return false ; } ) ; $ this -> filter = $ filter ; if ( $ gc = gc_enabled ( ) ) { gc_disable ( ) ; } try { return new Data ( $ this -> doClone ( $ var ) ) ; } finally { if ( $ gc ) { gc_enable ( ) ; } restore_error_handler ( ) ; $ this -> prevErrorHandler = null ; } }
Clones a PHP variable.

@param mixed $var    Any PHP variable
@param int   $filter A bit field of Caster::EXCLUDE_* constants

@return Data The cloned variable represented by a Data object
Clones a PHP variable .