当前位置: 首页>>代码示例>>PHP>>正文


PHP ReflectionProperty::__construct方法代码示例

本文整理汇总了PHP中ReflectionProperty::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP ReflectionProperty::__construct方法的具体用法?PHP ReflectionProperty::__construct怎么用?PHP ReflectionProperty::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ReflectionProperty的用法示例。


在下文中一共展示了ReflectionProperty::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __construct

 /**
  * 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);
 }
开发者ID:mseshachalam,项目名称:reflection,代码行数:16,代码来源:ReflectionProperty.php

示例2: __construct

 public function __construct($class, $name)
 {
     if (self::$adapterClass !== null) {
         $this->adapter = new self::$adapterClass($class, $name);
     } else {
         parent::__construct($class, $name);
     }
 }
开发者ID:phspring,项目名称:common,代码行数:8,代码来源:ReflectionProperty.php

示例3: __construct

 public function __construct($class, $name)
 {
     try {
         parent::__construct($class, $name);
     } catch (\ReflectionException $e) {
         $this->_name = $name;
     }
 }
开发者ID:ncud,项目名称:sagalaya,代码行数:8,代码来源:SchemaReflectionProperty.php

示例4: __construct

 /**
  * 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());
 }
开发者ID:naderman,项目名称:ezc-reflection,代码行数:21,代码来源:property.php

示例5: __construct

 /**
  * 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));
     }
 }
开发者ID:jstewmc,项目名称:refraction,代码行数:55,代码来源:RefractionProperty.php

示例6: __initialize

 /**
  * Implementation of internal reflection initialization
  *
  * @return void
  */
 protected function __initialize()
 {
     parent::__construct($this->className, $this->getName());
 }
开发者ID:console-helpers,项目名称:parser-reflection,代码行数:9,代码来源:ReflectionProperty.php

示例7: __construct

 public function __construct($class, $name)
 {
     parent::__construct($class, $name);
     $this->annotations = $this->createParser()->parse(AddendumCompatibility::getDocComment($this));
 }
开发者ID:rafaelss,项目名称:php-codes,代码行数:5,代码来源:annotations.php

示例8: __construct

 public function __construct(&$class, $name)
 {
     parent::__construct($class, $name);
     $this->annotations = tlalokes_parser_annotations($this);
 }
开发者ID:nmicht,项目名称:tlalokes-in-acst,代码行数:5,代码来源:ReflectionAnnotatedProperty.php

示例9: __construct

 /**
  * 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;
 }
开发者ID:qa-tools,项目名称:qa-tools,代码行数:11,代码来源:Property.php

示例10: __construct

 /**
  * 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;
 }
开发者ID:kornrunner,项目名称:PHP-Token-Reflection,代码行数:12,代码来源:ReflectionProperty.php

示例11: __construct

 public function __construct(Type $type, $property, Reflection $reflection)
 {
     parent::__construct($type->name, $property);
     $this->type = $type;
     $this->reflection = $reflection;
 }
开发者ID:spotframework,项目名称:spot,代码行数:6,代码来源:Property.php

示例12: __construct

 public function __construct($name, $class)
 {
     parent::__construct($name, $class);
 }
开发者ID:crodas,项目名称:notoj,代码行数:4,代码来源:ReflectionProperty.php

示例13: __construct

 public function __construct($name, $class)
 {
     parent::__construct($name, $class);
     $this->annotation = Notoj::parseDocComment($this);
 }
开发者ID:agpmedia,项目名称:notoj,代码行数:5,代码来源:ReflectionProperty.php

示例14: __construct

 /**
  * 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);
 }
开发者ID:khanhdeux,项目名称:typo3test,代码行数:10,代码来源:PropertyReflection.php

示例15: __construct

 /**
  * Return new ReflectionProperty object
  * @param string|object $class
  * @param string $name
  */
 public function __construct($class, $name)
 {
     $this->klass = $class;
     parent::__construct($class, $name);
 }
开发者ID:suin,项目名称:php-expose,代码行数:10,代码来源:ReflectionProperty.php


注:本文中的ReflectionProperty::__construct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。