/**
  * Constructs a new ReflectionProperty object.
  *
  * @param string|object $class
  * @param string $name
  * @throws ReflectionException
  * @return ReflectionProperty
  */
 public final function __construct($class, $name)
 {
     $bt = debug_backtrace();
     if (!isset($bt[1]['class']) || $bt[1]['class'] !== __CLASS__) {
         throw new ReflectionException('ReflectionClass\' constructor cannot be called from outside the class');
     }
     parent::__construct($class, $name);
 }
Example #2
0
 public function __construct($class, $name)
 {
     if (self::$adapterClass !== null) {
         $this->adapter = new self::$adapterClass($class, $name);
     } else {
         parent::__construct($class, $name);
     }
 }
 public function __construct($class, $name)
 {
     try {
         parent::__construct($class, $name);
     } catch (\ReflectionException $e) {
         $this->_name = $name;
     }
 }
Example #4
0
 /**
  * Constructs a new ezcReflectionProperty object
  *
  * Throws an Exception in case the given property does not exist
  * @param string|object|ReflectionProperty $class
  *        Name, instance of the property's class
  *        or ReflectionProperty object of the property
  * @param string $name
  *        Name of the property to be reflected.
  *        Can be null or will be ignored if a ReflectionProperty object is
  *        given as first parameter.
  */
 public function __construct($class, $name = null)
 {
     if (!$class instanceof ReflectionProperty) {
         parent::__construct($class, $name);
     }
     $this->reflectionSource = $class;
     $this->docParser = ezcReflection::getDocCommentParser();
     $this->docParser->parse($this->getDocComment());
 }
 /**
  * Called when the object is constructed
  *
  * @param   object  $instance  the property's instance
  * @param   string  $name      the property's name
  * @return  self
  * @throws  InvalidArgumentException  if $instance is not an object
  * @throws  InvalidArgumentException  if $name is not a string
  * @throws  OutOfBoundsException      if property does not exist
  * @throws  OutOfBoundsException      if property does exist but is not visible
  * @throws  ReflectionException       if something else goes wrong
  * @since   0.1.0
  */
 public function __construct($instance, $name)
 {
     // if $instance is not an object, short-circuit
     if (!is_object($instance)) {
         throw new \InvalidArgumentException(__METHOD__ . "() expects parameter one, instance, to be an object");
     }
     // if $name is not a string, short-circuit
     if (!is_string($name)) {
         throw new \InvalidArgumentException(__METHOD__ . "() expects parameter two, name, to be a string");
     }
     // try to get the property
     try {
         $property = (new \ReflectionClass($instance))->getProperty($name);
         // try to finish constructing the object
         try {
             // if the property is not visible, short-circuit
             if ($property->isPrivate() && $property->class !== get_class($instance)) {
                 throw new \OutOfBoundsException("Property '{$name}' is defined but not visible to " . get_class($instance));
             }
             // chain the parent's constructor
             parent::__construct($instance, $name);
             // otherwise, set the property to accessible
             // keep in mind, the property maintains its original visibility
             //     outside of this object's scope
             //
             $this->setAccessible(true);
             // set the data
             $this->instance = $instance;
             return;
         } catch (\ReflectionException $e) {
             // otherwise, an exception occured
             // re-throw the original exception
             //
             throw $e;
         }
     } catch (\ReflectionException $e) {
         // otherwise, the property does not exist
         // throw an OutOfBoundsException
         //
         throw new \OutOfBoundsException("Property '{$name}' must be defined in class " . get_class($instance));
     }
 }
 /**
  * Implementation of internal reflection initialization
  *
  * @return void
  */
 protected function __initialize()
 {
     parent::__construct($this->className, $this->getName());
 }
Example #7
0
 public function __construct($class, $name)
 {
     parent::__construct($class, $name);
     $this->annotations = $this->createParser()->parse(AddendumCompatibility::getDocComment($this));
 }
 public function __construct(&$class, $name)
 {
     parent::__construct($class, $name);
     $this->annotations = tlalokes_parser_annotations($this);
 }
Example #9
0
 /**
  * Create class instance from reflection property.
  *
  * @param \ReflectionProperty $property           Reflection property.
  * @param AnnotationManager   $annotation_manager Annotation manager.
  */
 public function __construct(\ReflectionProperty $property, AnnotationManager $annotation_manager)
 {
     parent::__construct($property->class, $property->name);
     $this->annotationManager = $annotation_manager;
 }
 /**
  * Constructor.
  *
  * @param string|\TokenReflection\Php\ReflectionClass|\ReflectionClass $class Defining class
  * @param string $propertyName Property name
  * @param \TokenReflection\Broker $broker Reflection broker
  */
 public function __construct($class, $propertyName, Broker $broker)
 {
     parent::__construct($class, $propertyName);
     $this->broker = $broker;
 }
Example #11
0
 public function __construct(Type $type, $property, Reflection $reflection)
 {
     parent::__construct($type->name, $property);
     $this->type = $type;
     $this->reflection = $reflection;
 }
Example #12
0
 public function __construct($name, $class)
 {
     parent::__construct($name, $class);
 }
Example #13
0
 public function __construct($name, $class)
 {
     parent::__construct($name, $class);
     $this->annotation = Notoj::parseDocComment($this);
 }
 /**
  * The constructor, initializes the reflection class
  *
  * @param string $className Name of the property's class
  * @param string $propertyName Name of the property to reflect
  */
 public function __construct($className, $propertyName)
 {
     parent::__construct($className, $propertyName);
 }
Example #15
0
 /**
  * Return new ReflectionProperty object
  * @param string|object $class
  * @param string $name
  */
 public function __construct($class, $name)
 {
     $this->klass = $class;
     parent::__construct($class, $name);
 }
Example #16
0
 /**
  * __construct function.
  * @param mixed $class object or a string(class name)
  * @param string $name
  */
 public function __construct($class, $name)
 {
     parent::__construct($class, $name);
     $this->getAllTags();
 }
 public function __construct($class, $name)
 {
     parent::__construct($class, $name);
     $this->annotations = $this->createAnnotationBuilder()->build($this);
 }
 /**
  * ReflectionProperty constructor.
  *
  * @param mixed  $class
  * @param string $name
  */
 public function __construct($class, $name)
 {
     parent::__construct($class, $name);
     $this->typeHint = new TypHint($this);
 }