/** * Constructor * * @param mixed $class Classname or object (object of the class) that contains the method. * @param string $name Name of the method * @access public * @return void */ public function __construct($class, $name) { parent::__construct($class, $name); // get the annotations $parser = new AnnotationParser($this->getDocComment()); $this->annotations = $parser->getAnnotationArray(); }
/** * Construct a new reflection method object * @param mixed $classOrName * @param string $name name of the class * @return null */ public function __construct($classOrName = null, $name = null) { parent::__construct($classOrName, $name); if ($name) { $this->className = $classOrName; } }
/** * Constructs a new ReflectionMethod object. * * @param string|object $class * @param string $name * @throws ReflectionException * @return ReflectionMethod */ 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); }
/** * @param mixed $class * @param string $name * * @throws \LogicException */ public function __construct($class, $name) { parent::__construct($class, $name); if (!$this->getDocComment()) { throw new \LogicException(sprintf("Missing phpdoc on method '%s::%s()'", $this->getDeclaringClass()->getName(), $this->getName())); } $this->parsePhpDoc($this->getDocComment(), $this->getDeclaringClass()->getName(), $this->getName()); }
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, $object, array $arguments = array()) { parent::__construct($class, $name); if (!is_object($object)) { throw new \InvalidArgumentException('$object must be an object.'); } $this->arguments = $arguments; $this->object = $object; }
/** * Called when the object is constructed * * @param object $instance the method's instance * @param string $name the method's name * @return self * @throws InvalidArgumentException if $instance is not an object * @throws InvalidArgumentException if $name is not a string * @throws OutOfBoundsException if method does not exist * @throws OutOfBoundsException if method 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 method try { $method = (new \ReflectionClass($instance))->getMethod($name); // try to finish constructing the object try { // if the method is not visible, short-circuit if ($method->isPrivate() && $method->class !== get_class($instance)) { throw new \OutOfBoundsException("Method {$name}() is defined but not visible to " . get_class($instance)); } // otherwise, chain the parent's constructor parent::__construct($instance, $name); // set the method's accessibility // keep in mind, the method maintains its original visibility outside // of this object's scope // $this->setAccessible(true); // save the method's instance $this->instance = $instance; return; } catch (\ReflectionException $e) { // otherwise, something else went wrong // re-throw the original ReflectionException // throw $e; } } catch (\ReflectionException $e) { // otherwise, the method does not exist // throw an OutOfBoundsException // throw new \OutOfBoundsException("Method {$name}() must be defined in class " . get_class($instance)); } }
/** * Constructs an new ezcReflectionMethod * * Usage Examples: * <code> * new ezcReflectionMethod( 'SomeClass', 'someMethod' ); * new ezcReflectionMethod( new ReflectionClass( 'SomeClass' ), 'someMethod' ); * new ezcReflectionMethod( 'SomeClass', new ReflectionMethod( 'SomeClass', 'someMethod' ) ); * new ezcReflectionMethod( new ReflectionClass( 'SomeClass' ), new ReflectionMethod( 'SomeClass', 'someMethod' ) ); * </code> * * The following way of creating an ezcReflectionMethod results in the * current class being the declaring class, i.e., isInherited() and * isIntroduced() may not return the expected results: * <code> * new ezcReflectionMethod( new ReflectionMethod( 'SomeClass', 'someMethod' ) ); * </code> * * @param string|ReflectionClass|ReflectionMethod $classOrSource * Name of class, ReflectionClass, or ReflectionMethod of the method * to be reflected * @param string|ReflectionMethod $nameOrSource * Name or ReflectionMethod instance of the method to be reflected * Optional if $classOrSource is an instance of ReflectionMethod */ public function __construct($classOrSource, $nameOrSource = null) { if ($nameOrSource instanceof parent) { $this->reflectionSource = $nameOrSource; if ($classOrSource instanceof ReflectionClass) { $this->currentClass = $classOrSource; } else { $this->currentClass = new ReflectionClass((string) $classOrSource); } } elseif ($classOrSource instanceof parent) { $this->reflectionSource = $classOrSource; $this->currentClass = new ReflectionClass($this->reflectionSource->class); } elseif ($classOrSource instanceof ReflectionClass) { parent::__construct($classOrSource->getName(), $nameOrSource); $this->currentClass = $classOrSource; } else { parent::__construct($classOrSource, $nameOrSource); $this->currentClass = new ReflectionClass((string) $classOrSource); } $this->docParser = ezcReflection::getDocCommentParser(); $this->docParser->parse($this->getDocComment()); }
public function __construct($name, $class) { parent::__construct($name, $class); }
function __construct($c, $m) { echo __METHOD__ . "\n"; parent::__construct($c, $m); }
public function __construct($class, $name) { parent::__construct($class, $name); $this->annotations = $this->createParser()->parse(AddendumCompatibility::getDocComment($this)); }
/** * inits model * @param string $class parsed class classname * @param string $name parsed class methodname */ public function __construct($class, $name) { parent::__construct($class, $name); $this->processComment(); }
public function __construct($name, $class) { parent::__construct($name, $class); $this->annotation = Notoj::parseDocComment($this); }
public function __construct(Type $type, $method, Reflection $reflection) { parent::__construct($type->name, $method); $this->type = $type; $this->reflection = $reflection; }
/** * Constructor. * * @param string|\TokenReflection\Php\ReflectionClass|\ReflectionClass $class Defining class * @param string $methodName Method name * @param \TokenReflection\Broker $broker Reflection broker */ public function __construct($class, $methodName, Broker $broker) { parent::__construct($class, $methodName); $this->broker = $broker; }
/** * CTOR * * @param string $class * @param string $name */ public function __construct($class, $name) { parent::__construct($class, $name); }
function __construct($class_or_method, $name = null, $stdClassConstructArgs = array()) { parent::__construct($class_or_method, $name); $this->stdClassConstructArgs = $stdClassConstructArgs; }
/** * Implementation of internal reflection initialization * * @return void */ protected function __initialize() { parent::__construct($this->className, $this->getName()); }
/** * The constructor, initializes the reflection class * * @param string $className Name of the method's class * @param string $methodName Name of the method to reflect * @return void * @author Robert Lemke <*****@*****.**> */ public function __construct($className, $methodName) { parent::__construct($className, $methodName); }
public function __construct(&$class, $name) { parent::__construct($class, $name); $this->annotations = tlalokes_parser_annotations($this); }
public function __construct($obj, $mth) { parent::__construct($obj, $mth); $this->visibility = Reflection::getModifierNames($this->getModifiers()); }
/** * Return new ReflectionMethod object * @param string|object $class * @param string $name */ public function __construct($class, $name) { $this->klass = $class; parent::__construct($class, $name); }
public function __construct($class, $name) { parent::__construct($class, $name); $this->annotations = $this->createAnnotationBuilder()->build($this); }
public function __construct($class, $name) { parent::__construct($class, $name); $this->comments = PicoraDocumentation::arrayFromDocComment($this->getDocComment()); $this->comments['name'] = $name; $this->comments['class'] = $class; $this->comments['file'] = $this->getFileName(); $this->comments['visibility'] = ''; foreach (array('abstract', 'final', 'static', 'public', 'protected', 'private') as $v) { if ($this->{'is' . ucfirst($v)}()) { $this->comments['visibility'] .= $v . ' '; } } }