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


PHP ReflectionMethod::__construct方法代码示例

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


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

示例1: __construct

 /**
  * 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();
 }
开发者ID:mattrwallace,项目名称:exegesis,代码行数:15,代码来源:annotationmethod.php

示例2: __construct

 /**
  * 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;
     }
 }
开发者ID:BGCX261,项目名称:zibo-svn-to-git,代码行数:13,代码来源:ReflectionMethod.php

示例3: __construct

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

示例4: __construct

 /**
  * @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());
 }
开发者ID:cawaphp,项目名称:module-swagger-server,代码行数:14,代码来源:ReflectionMethod.php

示例5: __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,代码来源:ReflectionMethod.php

示例6: __construct

 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;
 }
开发者ID:artz20,项目名称:Tv-shows-zone,代码行数:9,代码来源:MethodInvocation.php

示例7: __construct

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

示例8: __construct

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

示例9: __construct

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

示例10:

 function __construct($c, $m)
 {
     echo __METHOD__ . "\n";
     parent::__construct($c, $m);
 }
开发者ID:badlamer,项目名称:hhvm,代码行数:5,代码来源:002.php

示例11: __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

示例12: __construct

 /**
  * 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();
 }
开发者ID:bariew,项目名称:yii2-doctest-extension,代码行数:10,代码来源:MethodParser.php

示例13: __construct

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

示例14: __construct

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

示例15: __construct

 /**
  * 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;
 }
开发者ID:BozzaCoon,项目名称:SPHERE-Framework,代码行数:12,代码来源:ReflectionMethod.php


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