當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。