[ Index ]

PHP Cross Reference of phpBB-3.3.7-deutsch

title

Body

[close]

/vendor/zendframework/zend-code/src/Reflection/DocBlock/Tag/ -> ParamTag.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 preg_replace;
  15  use function trim;
  16  
  17  class ParamTag implements TagInterface, PhpDocTypedTagInterface
  18  {
  19      /**
  20       * @var array
  21       */
  22      protected $types = [];
  23  
  24      /**
  25       * @var string
  26       */
  27      protected $variableName;
  28  
  29      /**
  30       * @var string
  31       */
  32      protected $description;
  33  
  34      /**
  35       * @return string
  36       */
  37      public function getName()
  38      {
  39          return 'param';
  40      }
  41  
  42      /**
  43       * Initializer
  44       *
  45       * @param  string $tagDocBlockLine
  46       */
  47      public function initialize($tagDocBlockLine)
  48      {
  49          $matches = [];
  50  
  51          if (! preg_match('#((?:[\w|\\\]+(?:\[\])*\|?)+)(?:\s+(\$\S+))?(?:\s+(.*))?#s', $tagDocBlockLine, $matches)) {
  52              return;
  53          }
  54  
  55          $this->types = explode('|', $matches[1]);
  56  
  57          if (isset($matches[2])) {
  58              $this->variableName = $matches[2];
  59          }
  60  
  61          if (isset($matches[3])) {
  62              $this->description = trim(preg_replace('#\s+#', ' ', $matches[3]));
  63          }
  64      }
  65  
  66      /**
  67       * Get parameter variable type
  68       *
  69       * @return string
  70       * @deprecated 2.0.4 use getTypes instead
  71       */
  72      public function getType()
  73      {
  74          if (empty($this->types)) {
  75              return '';
  76          }
  77  
  78          return $this->types[0];
  79      }
  80  
  81      public function getTypes()
  82      {
  83          return $this->types;
  84      }
  85  
  86      /**
  87       * Get parameter name
  88       *
  89       * @return string
  90       */
  91      public function getVariableName()
  92      {
  93          return $this->variableName;
  94      }
  95  
  96      /**
  97       * @return string
  98       */
  99      public function getDescription()
 100      {
 101          return $this->description;
 102      }
 103  }


Generated: Thu Mar 24 21:31:15 2022 Cross-referenced by PHPXref 0.7.1