Exemplo n.º 1
0
 /**
  * @param object|string object or class name
  * @param string method name
  */
 public function __construct($object, $method)
 {
     parent::__construct($object, new ReflectionMethod($object, $method));
     $ac = PHP_VERSION_ID < 50302 ? 'AccessAccessorPhp52' : 'AccessAccessor';
     $accessor = new $ac();
     $this->access = $accessor->accessMethod($this->reflection);
 }
Exemplo n.º 2
0
 /**
  * @param object|NULL
  * @return AccessClass $this
  */
 public function asInstance($object)
 {
     parent::asInstance($object);
     foreach ($this->methods as $a) {
         $a->asInstance($this->instance);
     }
     foreach ($this->properties as $a) {
         $a->asInstance($this->instance);
     }
     return $this;
 }
Exemplo n.º 3
0
 /**
  * @param object|string object or class name
  * @param string property name
  */
 public function __construct($object, $property)
 {
     try {
         $r = new ReflectionProperty($object, $property);
     } catch (ReflectionException $e) {
         $class = $object;
         while ($class = get_parent_class($class)) {
             try {
                 $r = new ReflectionProperty($class, $property);
                 break;
             } catch (ReflectionException $ee) {
             }
         }
         if (!isset($r)) {
             throw $e;
         }
     }
     parent::__construct($object, $r);
     $ac = PHP_VERSION_ID < 50300 ? 'AccessAccessorPhp52' : 'AccessAccessor';
     $accessor = new $ac();
     $this->access = $accessor->accessProperty($this->reflection);
 }