[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/zendframework/zend-code/src/Reflection/ -> ParameterReflection.php (source)

   1  <?php
   2  /**
   3   * Zend Framework (http://framework.zend.com/)
   4   *
   5   * @link      http://github.com/zendframework/zf2 for the canonical source repository
   6   * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
   7   * @license   http://framework.zend.com/license/new-bsd New BSD License
   8   */
   9  
  10  namespace Zend\Code\Reflection;
  11  
  12  use ReflectionParameter;
  13  
  14  class ParameterReflection extends ReflectionParameter implements ReflectionInterface
  15  {
  16      /**
  17       * @var bool
  18       */
  19      protected $isFromMethod = false;
  20  
  21      /**
  22       * Get declaring class reflection object
  23       *
  24       * @return ClassReflection
  25       */
  26      public function getDeclaringClass()
  27      {
  28          $phpReflection  = parent::getDeclaringClass();
  29          $zendReflection = new ClassReflection($phpReflection->getName());
  30          unset($phpReflection);
  31  
  32          return $zendReflection;
  33      }
  34  
  35      /**
  36       * Get class reflection object
  37       *
  38       * @return ClassReflection
  39       */
  40      public function getClass()
  41      {
  42          $phpReflection = parent::getClass();
  43          if ($phpReflection === null) {
  44              return;
  45          }
  46  
  47          $zendReflection = new ClassReflection($phpReflection->getName());
  48          unset($phpReflection);
  49  
  50          return $zendReflection;
  51      }
  52  
  53      /**
  54       * Get declaring function reflection object
  55       *
  56       * @return FunctionReflection|MethodReflection
  57       */
  58      public function getDeclaringFunction()
  59      {
  60          $phpReflection = parent::getDeclaringFunction();
  61          if ($phpReflection instanceof \ReflectionMethod) {
  62              $zendReflection = new MethodReflection($this->getDeclaringClass()->getName(), $phpReflection->getName());
  63          } else {
  64              $zendReflection = new FunctionReflection($phpReflection->getName());
  65          }
  66          unset($phpReflection);
  67  
  68          return $zendReflection;
  69      }
  70  
  71      /**
  72       * Get parameter type
  73       *
  74       * @return string
  75       */
  76      public function getType()
  77      {
  78          if ($this->isArray()) {
  79              return 'array';
  80          } elseif (method_exists($this, 'isCallable') && $this->isCallable()) {
  81              return 'callable';
  82          }
  83  
  84          if (($class = $this->getClass()) instanceof \ReflectionClass) {
  85              return $class->getName();
  86          }
  87  
  88          $docBlock = $this->getDeclaringFunction()->getDocBlock();
  89          if (!$docBlock instanceof DocBlockReflection) {
  90              return;
  91          }
  92  
  93          $params = $docBlock->getTags('param');
  94          if (isset($params[$this->getPosition()])) {
  95              return $params[$this->getPosition()]->getType();
  96          }
  97  
  98          return;
  99      }
 100  
 101      /**
 102       * @return string
 103       */
 104      public function toString()
 105      {
 106          return parent::__toString();
 107      }
 108  
 109      /**
 110       * @return string
 111       */
 112      public function __toString()
 113      {
 114          return parent::__toString();
 115      }
 116  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1