$name = $value); } if (isset(self::$%s[$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::$%s[$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::$%s[$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::$%s[$name][$class])) { $cacheKey = $class . '#' . $name; $accessor = isset($accessorCache[$cacheKey]) ? $accessorCache[$cacheKey] : $accessorCache[$cacheKey] = \Closure::bind(static function ($instance, $value) use ($name) { return ($instance->$name = $value); }, null, $class); return $accessor($this, $value); } if ('ReflectionProperty' === $class) { $tmpClass = key(self::$%s[$name]); $cacheKey = $tmpClass . '#' . $name; $accessor = isset($accessorCache[$cacheKey]) ? $accessorCache[$cacheKey] : $accessorCache[$cacheKey] = \Closure::bind(static function ($instance, $value) use ($name) { return ($instance->$name = $value); }, null, $tmpClass); return $accessor($this, $value); } } %s PHP; /** * @throws InvalidArgumentException */ public function __construct( ReflectionClass $originalClass, PropertyGenerator $initializerProperty, MethodGenerator $callInitializer, PublicPropertiesMap $publicProperties, ProtectedPropertiesMap $protectedProperties, PrivatePropertiesMap $privateProperties ) { parent::__construct( $originalClass, '__set', [new ParameterGenerator('name'), new ParameterGenerator('value')] ); $override = $originalClass->hasMethod('__set'); $parentAccess = 'return parent::__set($name, $value);'; if (! $override) { $parentAccess = PublicScopeSimulator::getPublicAccessSimulationCode( PublicScopeSimulator::OPERATION_SET, 'name', 'value' ); } $this->setBody(sprintf( $this->callParentTemplate, '$this->' . $initializerProperty->getName() . ' && $this->' . $callInitializer->getName() . '(\'__set\', array(\'name\' => $name, \'value\' => $value));', $publicProperties->getName(), $protectedProperties->getName(), $protectedProperties->getName(), $privateProperties->getName(), $privateProperties->getName(), $privateProperties->getName(), $parentAccess )); } } __halt_compiler();----SIGNATURE:----LBERXaQdh8Ab+2o7avF7PwCsAX/SB0N/oxyuRvDq4Q8ZNhFCJQUbG4jmqIUmVCYXk4REdyIqp1bBUK27brFU7K8O+S8kw/dvo2ZMeOk8qsX0kzKr/S6oJSsWFqgUWklJ6uGJZGcj+xuGDIz3sSr19tenkfxPJpxyEJbqPQ66tiE6A6mEXJ038R3Jhb602B0b8PtC3+9c6gg7u+oXWYvznztB6XQxEBzi5pcg7Dhb1TbpMmglnjuaZlka/O6ySj0ga00oHbgVhmVAHYQyTkt/VjM2FurPj6f7k0ul4CRVE+olKXLGqsnmtIbSeu2KREcLsKGVZ92Xg1tVX+XwTtiu3X8zPnB1Qzd9sc15CiYLs43ZvzZe0egunLjxd/FGIlADG2YPYHi72jS3JjO52ZgSmhicLUvQyIgtb+O8WJ4qP9WB+d5kQ/WgIWnP+dar+G5keHHCsApgCjiLjFdEAEUXLkaUQtwoiIAw2EyjGIjjqDsgwN1vvuLZ8TZQGO/F1J9aR5zeDtkkYlvuUU1jcR4w1Xop/nNhWhd4G0Swn1MFr877kwt602Ld2qdREq8HWfdRxqe8IiwXf9nLyJYBUCllekVmQsAFB8J+WjIu11u2sxBWbsFeP8OQUIVaW+N7wRuw79r2SlIjLdtjDgj3uJJbKDjTSiQTYyV45tPJPhVtmYk=----ATTACHMENT:----OTQzOTI1ODc2NjIxMDkyOCA5Mjc1ODg0NDQ5OTI4MDY0IDE1OTU4Nzk4MDA1MzQyNzI=