[ Index ]

PHP Cross Reference of phpBB-3.3.5-deutsch

title

Body

[close]

/vendor/zendframework/zend-code/src/Reflection/DocBlock/Tag/ -> MethodTag.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-2016 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\DocBlock\Tag;
  11  
  12  use function explode;
  13  use function preg_match;
  14  use function rtrim;
  15  
  16  class MethodTag implements TagInterface, PhpDocTypedTagInterface
  17  {
  18      /**
  19       * Return value type
  20       *
  21       * @var array
  22       */
  23      protected $types = [];
  24  
  25      /**
  26       * @var string
  27       */
  28      protected $methodName;
  29  
  30      /**
  31       * @var string
  32       */
  33      protected $description;
  34  
  35      /**
  36       * Is static method
  37       *
  38       * @var bool
  39       */
  40      protected $isStatic = false;
  41  
  42      /**
  43       * @return string
  44       */
  45      public function getName()
  46      {
  47          return 'method';
  48      }
  49  
  50      /**
  51       * Initializer
  52       *
  53       * @param  string $tagDocblockLine
  54       */
  55      public function initialize($tagDocblockLine)
  56      {
  57          $match = [];
  58  
  59          if (! preg_match('#^(static[\s]+)?(.+[\s]+)?(.+\(\))[\s]*(.*)$#m', $tagDocblockLine, $match)) {
  60              return;
  61          }
  62  
  63          if ($match[1] !== '') {
  64              $this->isStatic = true;
  65          }
  66  
  67          if ($match[2] !== '') {
  68              $this->types = explode('|', rtrim($match[2]));
  69          }
  70  
  71          $this->methodName = $match[3];
  72  
  73          if ($match[4] !== '') {
  74              $this->description = $match[4];
  75          }
  76      }
  77  
  78      /**
  79       * Get return value type
  80       *
  81       * @return null|string
  82       * @deprecated 2.0.4 use getTypes instead
  83       */
  84      public function getReturnType()
  85      {
  86          if (empty($this->types)) {
  87              return;
  88          }
  89  
  90          return $this->types[0];
  91      }
  92  
  93      public function getTypes()
  94      {
  95          return $this->types;
  96      }
  97  
  98      /**
  99       * @return string
 100       */
 101      public function getMethodName()
 102      {
 103          return $this->methodName;
 104      }
 105  
 106      /**
 107       * @return null|string
 108       */
 109      public function getDescription()
 110      {
 111          return $this->description;
 112      }
 113  
 114      /**
 115       * @return bool
 116       */
 117      public function isStatic()
 118      {
 119          return $this->isStatic;
 120      }
 121  
 122      public function __toString()
 123      {
 124          return 'DocBlock Tag [ * @' . $this->getName() . ' ]' . "\n";
 125      }
 126  }


Generated: Mon Oct 4 17:42:11 2021 Cross-referenced by PHPXref 0.7.1