本文整理汇总了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);
}
示例2: __construct
public function __construct($class, $name)
{
if (self::$adapterClass !== null) {
$this->adapter = new self::$adapterClass($class, $name);
} else {
parent::__construct($class, $name);
}
}
示例3: __construct
public function __construct($class, $name)
{
try {
parent::__construct($class, $name);
} catch (\ReflectionException $e) {
$this->_name = $name;
}
}
示例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());
}
示例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));
}
}
示例6: __initialize
/**
* Implementation of internal reflection initialization
*
* @return void
*/
protected function __initialize()
{
parent::__construct($this->className, $this->getName());
}
示例7: __construct
public function __construct($class, $name)
{
parent::__construct($class, $name);
$this->annotations = $this->createParser()->parse(AddendumCompatibility::getDocComment($this));
}
示例8: __construct
public function __construct(&$class, $name)
{
parent::__construct($class, $name);
$this->annotations = tlalokes_parser_annotations($this);
}
示例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;
}
示例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;
}
示例11: __construct
public function __construct(Type $type, $property, Reflection $reflection)
{
parent::__construct($type->name, $property);
$this->type = $type;
$this->reflection = $reflection;
}
示例12: __construct
public function __construct($name, $class)
{
parent::__construct($name, $class);
}
示例13: __construct
public function __construct($name, $class)
{
parent::__construct($name, $class);
$this->annotation = Notoj::parseDocComment($this);
}
示例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);
}
示例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);
}