src/LazyProxy.php
protected function replaceProxy($offset)
    {
        $object = $this->getObject();

        /**
         * 0: LazyProxy::replaceProxy()
         * 1: LazyProxy::__get($name) / LazyProxy::__set($name, $value)
         *    2: Frame that accesses $name
         * 1: LazyProxy::__call($method, $arguments)
         * 2: LazyProxy::$method()
         *    3: Frame that invokes $method
         */
        $trace = debug_backtrace();

        if (isset($trace[$offset]['object'])) {
            $reflector = new \ReflectionObject($trace[$offset]['object']);

            foreach ($reflector->getProperties() as $property) {
                $property->setAccessible(true);

                if ($property->getValue($trace[$offset]['object']) === $this) {
                    $property->setValue($trace[$offset]['object'], $object);
                    break;
                }
            }
        }

        return $object;
    }
protected function replaceProxy($offset)
    {
        $object = $this->getObject();

        /**
         * 0: LazyProxy::replaceProxy()
         * 1: LazyProxy::__get($name) / LazyProxy::__set($name, $value)
         *    2: Frame that accesses $name
         * 1: LazyProxy::__call($method, $arguments)
         * 2: LazyProxy::$method()
         *    3: Frame that invokes $method
         */
        $trace = debug_backtrace();

        if (isset($trace[$offset]['object'])) {
            $reflector = new \ReflectionObject($trace[$offset]['object']);

            foreach ($reflector->getProperties() as $property) {
                $property->setAccessible(true);

                if ($property->getValue($trace[$offset]['object']) === $this) {
                    $property->setValue($trace[$offset]['object'], $object);
                    break;
                }
            }
        }

        return $object;
    }
protected function replaceProxy ( $ offset ) { $ object = $ this -> getObject ( ) ; /**
         * 0: LazyProxy::replaceProxy()
         * 1: LazyProxy::__get($name) / LazyProxy::__set($name, $value)
         *    2: Frame that accesses $name
         * 1: LazyProxy::__call($method, $arguments)
         * 2: LazyProxy::$method()
         *    3: Frame that invokes $method
         */ $ trace = debug_backtrace ( ) ; if ( isset ( $ trace [ $ offset ] [ 'object' ] ) ) { $ reflector = new \ ReflectionObject ( $ trace [ $ offset ] [ 'object' ] ) ; foreach ( $ reflector -> getProperties ( ) as $ property ) { $ property -> setAccessible ( true ) ; if ( $ property -> getValue ( $ trace [ $ offset ] [ 'object' ] ) === $ this ) { $ property -> setValue ( $ trace [ $ offset ] [ 'object' ] , $ object ) ; break ; } } } return $ object ; }
Tries to replace the lazy proxy object with the real object.

@param  integer $offset
@return object
Tries to replace the lazy proxy object with the real object .