Created
January 9, 2015 20:25
-
-
Save Ocramius/55cd7f709c91674add33 to your computer and use it in GitHub Desktop.
ProxyManager generated GhostObject
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace ProxyManagerTest\Functional; | |
class Foo54b039119141f998026307 extends \ProxyManagerTestAsset\ClassWithCollidingPrivateInheritedProperties implements \ProxyManager\Proxy\GhostObjectInterface | |
{ | |
/** | |
* @var \Closure|null initializer responsible for generating the wrapped object | |
*/ | |
private $initializer54b0391191613150023583 = null; | |
/** | |
* @var bool tracks initialization status - true while the object is initializing | |
*/ | |
private $initializationTracker54b039119162d798589302 = false; | |
/** | |
* @var bool[] map of public properties of the parent class | |
*/ | |
private static $publicProperties54b0391191518424527953 = array( | |
); | |
/** | |
* @var array[][] visibility and default value of defined properties, indexed by | |
* property name and class name | |
*/ | |
private static $privateProperties54b0391191559736069193 = array( | |
'property0' => array( | |
'ProxyManagerTestAsset\\ClassWithCollidingPrivateInheritedProperties' => true, | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
), | |
'property1' => array( | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
), | |
'property2' => array( | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
), | |
'property3' => array( | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
), | |
'property4' => array( | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
), | |
'property5' => array( | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
), | |
'property6' => array( | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
), | |
'property7' => array( | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
), | |
'property8' => array( | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
), | |
'property9' => array( | |
'ProxyManagerTestAsset\\ClassWithPrivateProperties' => true | |
) | |
); | |
/** | |
* @var string[][] declaring class name of defined protected properties, indexed by | |
* property name | |
*/ | |
private static $protectedProperties54b03911915d6788187119 = array( | |
); | |
/** | |
* Triggers initialization logic for this ghost object | |
* | |
* @param string $methodName | |
* @param mixed[] $parameters | |
* | |
* @return mixed | |
*/ | |
public function callInitializer54b0391191659572007968($methodName, array $parameters) | |
{ | |
if ($this->initializationTracker54b039119162d798589302 || ! $this->initializer54b0391191613150023583) { | |
return; | |
} | |
$this->initializationTracker54b039119162d798589302 = true; | |
static $cacheProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties; | |
$cacheProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties ?: $cacheProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties = \Closure::bind(function ($instance) { | |
$instance->property0 = 'childClassProperty0'; | |
}, null, 'ProxyManagerTestAsset\\ClassWithCollidingPrivateInheritedProperties'); | |
$cacheProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties($this); | |
static $cacheProxyManagerTestAsset_ClassWithPrivateProperties; | |
$cacheProxyManagerTestAsset_ClassWithPrivateProperties ?: $cacheProxyManagerTestAsset_ClassWithPrivateProperties = \Closure::bind(function ($instance) { | |
$instance->property0 = 'property0'; | |
$instance->property1 = 'property1'; | |
$instance->property2 = 'property2'; | |
$instance->property3 = 'property3'; | |
$instance->property4 = 'property4'; | |
$instance->property5 = 'property5'; | |
$instance->property6 = 'property6'; | |
$instance->property7 = 'property7'; | |
$instance->property8 = 'property8'; | |
$instance->property9 = 'property9'; | |
}, null, 'ProxyManagerTestAsset\\ClassWithPrivateProperties'); | |
$cacheProxyManagerTestAsset_ClassWithPrivateProperties($this); | |
$properties = [ | |
]; | |
static $cacheFetchProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties; | |
$cacheFetchProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties ?: $cacheFetchProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties = \Closure::bind(function ($instance, array & $properties) { | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithCollidingPrivateInheritedProperties' . "\0" . 'property0'] = & $instance->property0; | |
}, $this, 'ProxyManagerTestAsset\\ClassWithCollidingPrivateInheritedProperties'); | |
$cacheFetchProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties($this, $properties);static $cacheFetchProxyManagerTestAsset_ClassWithPrivateProperties; | |
$cacheFetchProxyManagerTestAsset_ClassWithPrivateProperties ?: $cacheFetchProxyManagerTestAsset_ClassWithPrivateProperties = \Closure::bind(function ($instance, array & $properties) { | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property0'] = & $instance->property0; | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property1'] = & $instance->property1; | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property2'] = & $instance->property2; | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property3'] = & $instance->property3; | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property4'] = & $instance->property4; | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property5'] = & $instance->property5; | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property6'] = & $instance->property6; | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property7'] = & $instance->property7; | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property8'] = & $instance->property8; | |
$properties['' . "\0" . 'ProxyManagerTestAsset\\ClassWithPrivateProperties' . "\0" . 'property9'] = & $instance->property9; | |
}, $this, 'ProxyManagerTestAsset\\ClassWithPrivateProperties'); | |
$cacheFetchProxyManagerTestAsset_ClassWithPrivateProperties($this, $properties); | |
$result = $this->initializer54b0391191613150023583->__invoke($this, $methodName, $parameters, $this->initializer54b0391191613150023583, $properties); | |
$this->initializationTracker54b039119162d798589302 = false; | |
return $result; | |
} | |
/** | |
* Constructor for lazy initialization | |
* | |
* @param \Closure|null $initializer | |
*/ | |
public static function staticProxyConstructor($initializer) | |
{ | |
static $reflection; | |
$reflection = $reflection ?: $reflection = new \ReflectionClass(__CLASS__); | |
$instance = (new \ReflectionClass(get_class()))->newInstanceWithoutConstructor(); | |
static $cacheProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties; | |
$cacheProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties ?: $cacheProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties = \Closure::bind(function ($instance) { | |
unset($instance->property0); | |
}, null, 'ProxyManagerTestAsset\\ClassWithCollidingPrivateInheritedProperties'); | |
$cacheProxyManagerTestAsset_ClassWithCollidingPrivateInheritedProperties($instance); | |
static $cacheProxyManagerTestAsset_ClassWithPrivateProperties; | |
$cacheProxyManagerTestAsset_ClassWithPrivateProperties ?: $cacheProxyManagerTestAsset_ClassWithPrivateProperties = \Closure::bind(function ($instance) { | |
unset($instance->property0, $instance->property1, $instance->property2, $instance->property3, $instance->property4, $instance->property5, $instance->property6, $instance->property7, $instance->property8, $instance->property9); | |
}, null, 'ProxyManagerTestAsset\\ClassWithPrivateProperties'); | |
$cacheProxyManagerTestAsset_ClassWithPrivateProperties($instance); | |
$instance->initializer54b0391191613150023583 = $initializer; | |
return $instance; | |
} | |
/** | |
* @param string $name | |
*/ | |
public function & __get($name) | |
{ | |
$this->initializer54b0391191613150023583 && $this->callInitializer54b0391191659572007968('__get', array('name' => $name)); | |
if (isset(self::$publicProperties54b0391191518424527953[$name])) { | |
return $this->$name; | |
} | |
if (isset(self::$protectedProperties54b03911915d6788187119[$name])) { | |
// check protected property access via compatible class | |
$callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); | |
$caller = isset($callers[1]) ? $callers[1] : []; | |
$object = isset($caller['object']) ? $caller['object'] : ''; | |
$expectedType = self::$protectedProperties54b03911915d6788187119[$name]; | |
if ($object instanceof $expectedType) { | |
return $this->$name; | |
} | |
$class = isset($caller['class']) ? $caller['class'] : ''; | |
if ($class === $expectedType || is_subclass_of($class, $expectedType) || $class === 'ReflectionProperty') { | |
return $this->$name; | |
} | |
} elseif (isset(self::$privateProperties54b0391191559736069193[$name])) { | |
// check private property access via same class | |
$callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); | |
$caller = isset($callers[1]) ? $callers[1] : []; | |
$class = isset($caller['class']) ? $caller['class'] : ''; | |
static $accessorCache = []; | |
if (isset(self::$privateProperties54b0391191559736069193[$name][$class])) { | |
$cacheKey = $class . '#' . $name; | |
$accessor = isset($accessorCache[$cacheKey]) | |
? $accessorCache[$cacheKey] | |
: $accessorCache[$cacheKey] = \Closure::bind(function & ($instance) use ($name) { | |
return $instance->$name; | |
}, null, $class); | |
return $accessor($this); | |
} | |
if ('ReflectionProperty' === $class) { | |
$tmpClass = key(self::$privateProperties54b0391191559736069193[$name]); | |
$cacheKey = $tmpClass . '#' . $name; | |
$accessor = isset($accessorCache[$cacheKey]) | |
? $accessorCache[$cacheKey] | |
: $accessorCache[$cacheKey] = \Closure::bind(function & ($instance) use ($name) { | |
return $instance->$name; | |
}, null, $tmpClass); | |
return $accessor($this); | |
} | |
} | |
$realInstanceReflection = new \ReflectionClass(get_parent_class($this)); | |
if (! $realInstanceReflection->hasProperty($name)) { | |
$targetObject = $this; | |
$backtrace = debug_backtrace(false); | |
trigger_error('Undefined property: ' . get_parent_class($this) . '::$' . $name . ' in ' . $backtrace[0]['file'] . ' on line ' . $backtrace[0]['line'], \E_USER_NOTICE); | |
return $targetObject->$name;; | |
return; | |
} | |
$targetObject = unserialize(sprintf('O:%d:"%s":0:{}', strlen(get_parent_class($this)), get_parent_class($this))); | |
$accessor = function & () use ($targetObject, $name) { | |
return $targetObject->$name; | |
}; | |
$backtrace = debug_backtrace(true); | |
$scopeObject = isset($backtrace[1]['object']) ? $backtrace[1]['object'] : new \stdClass(); | |
$accessor = $accessor->bindTo($scopeObject, get_class($scopeObject)); | |
$returnValue = & $accessor(); | |
return $returnValue; | |
} | |
/** | |
* @param string $name | |
*/ | |
public function __set($name, $value) | |
{ | |
$this->initializer54b0391191613150023583 && $this->callInitializer54b0391191659572007968('__set', array('name' => $name, 'value' => $value)); | |
if (isset(self::$publicProperties54b0391191518424527953[$name])) { | |
return ($this->$name = $value); | |
} | |
if (isset(self::$protectedProperties54b03911915d6788187119[$name])) { | |
// check protected property access via compatible class | |
$callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); | |
$caller = isset($callers[1]) ? $callers[1] : []; | |
$object = isset($caller['object']) ? $caller['object'] : ''; | |
$expectedType = self::$protectedProperties54b03911915d6788187119[$name]; | |
if ($object instanceof $expectedType) { | |
return ($this->$name = $value); | |
} | |
$class = isset($caller['class']) ? $caller['class'] : ''; | |
if ($class === $expectedType || is_subclass_of($class, $expectedType) || $class === 'ReflectionProperty') { | |
return ($this->$name = $value); | |
} | |
} elseif (isset(self::$privateProperties54b0391191559736069193[$name])) { | |
// check private property access via same class | |
$callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); | |
$caller = isset($callers[1]) ? $callers[1] : []; | |
$class = isset($caller['class']) ? $caller['class'] : ''; | |
static $accessorCache = []; | |
if (isset(self::$privateProperties54b0391191559736069193[$name][$class])) { | |
$cacheKey = $class . '#' . $name; | |
$accessor = isset($accessorCache[$cacheKey]) | |
? $accessorCache[$cacheKey] | |
: $accessorCache[$cacheKey] = \Closure::bind(function ($instance, $value) use ($name) { | |
return ($instance->$name = $value); | |
}, null, $class); | |
return $accessor($this, $value); | |
} | |
if ('ReflectionProperty' === $class) { | |
$tmpClass = key(self::$privateProperties54b0391191559736069193[$name]); | |
$cacheKey = $tmpClass . '#' . $name; | |
$accessor = isset($accessorCache[$cacheKey]) | |
? $accessorCache[$cacheKey] | |
: $accessorCache[$cacheKey] = \Closure::bind(function ($instance, $value) use ($name) { | |
return ($instance->$name = $value); | |
}, null, $tmpClass); | |
return $accessor($this, $value); | |
} | |
} | |
$realInstanceReflection = new \ReflectionClass(get_parent_class($this)); | |
if (! $realInstanceReflection->hasProperty($name)) { | |
$targetObject = $this; | |
return $targetObject->$name = $value;; | |
return; | |
} | |
$targetObject = unserialize(sprintf('O:%d:"%s":0:{}', strlen(get_parent_class($this)), get_parent_class($this))); | |
$accessor = function & () use ($targetObject, $name, $value) { | |
return $targetObject->$name = $value; | |
}; | |
$backtrace = debug_backtrace(true); | |
$scopeObject = isset($backtrace[1]['object']) ? $backtrace[1]['object'] : new \stdClass(); | |
$accessor = $accessor->bindTo($scopeObject, get_class($scopeObject)); | |
$returnValue = & $accessor(); | |
return $returnValue; | |
} | |
/** | |
* @param string $name | |
*/ | |
public function __isset($name) | |
{ | |
$this->initializer54b0391191613150023583 && $this->callInitializer54b0391191659572007968('__isset', array('name' => $name)); | |
if (isset(self::$publicProperties54b0391191518424527953[$name])) { | |
return isset($this->$name); | |
} | |
if (isset(self::$protectedProperties54b03911915d6788187119[$name])) { | |
// check protected property access via compatible class | |
$callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); | |
$caller = isset($callers[1]) ? $callers[1] : []; | |
$object = isset($caller['object']) ? $caller['object'] : ''; | |
$expectedType = self::$protectedProperties54b03911915d6788187119[$name]; | |
if ($object instanceof $expectedType) { | |
return isset($this->$name); | |
} | |
$class = isset($caller['class']) ? $caller['class'] : ''; | |
if ($class === $expectedType || is_subclass_of($class, $expectedType)) { | |
return isset($this->$name); | |
} | |
} else { | |
// check private property access via same class | |
$callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); | |
$caller = isset($callers[1]) ? $callers[1] : []; | |
$class = isset($caller['class']) ? $caller['class'] : ''; | |
static $accessorCache = []; | |
if (isset(self::$privateProperties54b0391191559736069193[$name][$class])) { | |
$cacheKey = $class . '#' . $name; | |
$accessor = isset($accessorCache[$cacheKey]) | |
? $accessorCache[$cacheKey] | |
: $accessorCache[$cacheKey] = \Closure::bind(function ($instance) use ($name) { | |
return isset($instance->$name); | |
}, null, $class); | |
return $accessor($this); | |
} | |
if ('ReflectionProperty' === $class) { | |
$tmpClass = key(self::$privateProperties54b0391191559736069193[$name]); | |
$cacheKey = $tmpClass . '#' . $name; | |
$accessor = isset($accessorCache[$cacheKey]) | |
? $accessorCache[$cacheKey] | |
: $accessorCache[$cacheKey] = \Closure::bind(function ($instance) use ($name) { | |
return isset($instance->$name); | |
}, null, $tmpClass); | |
return $accessor($this); | |
} | |
} | |
$realInstanceReflection = new \ReflectionClass(get_parent_class($this)); | |
if (! $realInstanceReflection->hasProperty($name)) { | |
$targetObject = $this; | |
return isset($targetObject->$name);; | |
return; | |
} | |
$targetObject = unserialize(sprintf('O:%d:"%s":0:{}', strlen(get_parent_class($this)), get_parent_class($this))); | |
$accessor = function () use ($targetObject, $name) { | |
return isset($targetObject->$name); | |
}; | |
$backtrace = debug_backtrace(true); | |
$scopeObject = isset($backtrace[1]['object']) ? $backtrace[1]['object'] : new \stdClass(); | |
$accessor = $accessor->bindTo($scopeObject, get_class($scopeObject)); | |
$returnValue = $accessor(); | |
return $returnValue; | |
} | |
/** | |
* @param string $name | |
*/ | |
public function __unset($name) | |
{ | |
$this->initializer54b0391191613150023583 && $this->callInitializer54b0391191659572007968('__unset', array('name' => $name)); | |
if (isset(self::$publicProperties54b0391191518424527953[$name])) { | |
unset($this->$name); | |
return; | |
} | |
if (isset(self::$protectedProperties54b03911915d6788187119[$name])) { | |
// check protected property access via compatible class | |
$callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); | |
$caller = isset($callers[1]) ? $callers[1] : []; | |
$object = isset($caller['object']) ? $caller['object'] : ''; | |
$expectedType = self::$protectedProperties54b03911915d6788187119[$name]; | |
if ($object instanceof $expectedType) { | |
unset($this->$name); | |
return; | |
} | |
$class = isset($caller['class']) ? $caller['class'] : ''; | |
if ($class === $expectedType || is_subclass_of($class, $expectedType) || $class === 'ReflectionProperty') { | |
unset($this->$name); | |
return; | |
} | |
} elseif (isset(self::$privateProperties54b0391191559736069193[$name])) { | |
// check private property access via same class | |
$callers = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT, 2); | |
$caller = isset($callers[1]) ? $callers[1] : []; | |
$class = isset($caller['class']) ? $caller['class'] : ''; | |
static $accessorCache = []; | |
if (isset(self::$privateProperties54b0391191559736069193[$name][$class])) { | |
$cacheKey = $class . '#' . $name; | |
$accessor = isset($accessorCache[$cacheKey]) | |
? $accessorCache[$cacheKey] | |
: $accessorCache[$cacheKey] = \Closure::bind(function ($instance) use ($name) { | |
unset($instance->$name); | |
}, null, $class); | |
return $accessor($this); | |
} | |
if ('ReflectionProperty' === $class) { | |
$tmpClass = key(self::$privateProperties54b0391191559736069193[$name]); | |
$cacheKey = $tmpClass . '#' . $name; | |
$accessor = isset($accessorCache[$cacheKey]) | |
? $accessorCache[$cacheKey] | |
: $accessorCache[$cacheKey] = \Closure::bind(function ($instance) use ($name) { | |
unset($instance->$name); | |
}, null, $tmpClass); | |
return $accessor($this); | |
} | |
} | |
$realInstanceReflection = new \ReflectionClass(get_parent_class($this)); | |
if (! $realInstanceReflection->hasProperty($name)) { | |
$targetObject = $this; | |
unset($targetObject->$name);; | |
return; | |
} | |
$targetObject = unserialize(sprintf('O:%d:"%s":0:{}', strlen(get_parent_class($this)), get_parent_class($this))); | |
$accessor = function () use ($targetObject, $name) { | |
unset($targetObject->$name); | |
}; | |
$backtrace = debug_backtrace(true); | |
$scopeObject = isset($backtrace[1]['object']) ? $backtrace[1]['object'] : new \stdClass(); | |
$accessor = $accessor->bindTo($scopeObject, get_class($scopeObject)); | |
$returnValue = $accessor(); | |
return $returnValue; | |
} | |
public function __clone() | |
{ | |
$this->initializer54b0391191613150023583 && $this->callInitializer54b0391191659572007968('__clone', []); | |
} | |
public function __sleep() | |
{ | |
$this->initializer54b0391191613150023583 && $this->callInitializer54b0391191659572007968('__sleep', []); | |
return array_keys((array) $this); | |
} | |
/** | |
* {@inheritDoc} | |
*/ | |
public function setProxyInitializer(\Closure $initializer = null) | |
{ | |
$this->initializer54b0391191613150023583 = $initializer; | |
} | |
/** | |
* {@inheritDoc} | |
*/ | |
public function getProxyInitializer() | |
{ | |
return $this->initializer54b0391191613150023583; | |
} | |
/** | |
* {@inheritDoc} | |
*/ | |
public function initializeProxy() | |
{ | |
return $this->initializer54b0391191613150023583 && $this->callInitializer54b0391191659572007968('initializeProxy', []); | |
} | |
/** | |
* {@inheritDoc} | |
*/ | |
public function isProxyInitialized() | |
{ | |
return ! $this->initializer54b0391191613150023583; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment