[ Index ]

PHP Cross Reference of phpBB-3.3.14-deutsch

title

Body

[close]

/vendor/zendframework/zend-code/src/Generator/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\Generator\DocBlock\Tag;
  11  
  12  use Zend\Code\Generator\DocBlock\TagManager;
  13  use Zend\Code\Reflection\DocBlock\Tag\TagInterface as ReflectionTagInterface;
  14  
  15  use function ltrim;
  16  
  17  class ParamTag extends AbstractTypeableTag implements TagInterface
  18  {
  19      /**
  20       * @var string
  21       */
  22      protected $variableName;
  23  
  24      /**
  25       * @param string $variableName
  26       * @param array $types
  27       * @param string $description
  28       */
  29      public function __construct($variableName = null, $types = [], $description = null)
  30      {
  31          if (! empty($variableName)) {
  32              $this->setVariableName($variableName);
  33          }
  34  
  35          parent::__construct($types, $description);
  36      }
  37  
  38      /**
  39       * @param ReflectionTagInterface $reflectionTag
  40       * @return ParamTag
  41       * @deprecated Deprecated in 2.3. Use TagManager::createTagFromReflection() instead
  42       */
  43      public static function fromReflection(ReflectionTagInterface $reflectionTag)
  44      {
  45          $tagManager = new TagManager();
  46          $tagManager->initializeDefaultTags();
  47          return $tagManager->createTagFromReflection($reflectionTag);
  48      }
  49  
  50      /**
  51       * @return string
  52       */
  53      public function getName()
  54      {
  55          return 'param';
  56      }
  57  
  58      /**
  59       * @param string $variableName
  60       * @return ParamTag
  61       */
  62      public function setVariableName($variableName)
  63      {
  64          $this->variableName = ltrim($variableName, '$');
  65          return $this;
  66      }
  67  
  68      /**
  69       * @return string
  70       */
  71      public function getVariableName()
  72      {
  73          return $this->variableName;
  74      }
  75  
  76      /**
  77       * @param string $datatype
  78       * @return ParamTag
  79       * @deprecated Deprecated in 2.3. Use setTypes() instead
  80       */
  81      public function setDatatype($datatype)
  82      {
  83          return $this->setTypes($datatype);
  84      }
  85  
  86      /**
  87       * @return string
  88       * @deprecated Deprecated in 2.3. Use getTypes() or getTypesAsString() instead
  89       */
  90      public function getDatatype()
  91      {
  92          return $this->getTypesAsString();
  93      }
  94  
  95      /**
  96       * @param  string $paramName
  97       * @return ParamTag
  98       * @deprecated Deprecated in 2.3. Use setVariableName() instead
  99       */
 100      public function setParamName($paramName)
 101      {
 102          return $this->setVariableName($paramName);
 103      }
 104  
 105      /**
 106       * @return string
 107       * @deprecated Deprecated in 2.3. Use getVariableName() instead
 108       */
 109      public function getParamName()
 110      {
 111          return $this->getVariableName();
 112      }
 113  
 114      /**
 115       * @return string
 116       */
 117      public function generate()
 118      {
 119          $output = '@param'
 120              . (! empty($this->types) ? ' ' . $this->getTypesAsString() : '')
 121              . (! empty($this->variableName) ? ' $' . $this->variableName : '')
 122              . (! empty($this->description) ? ' ' . $this->description : '');
 123  
 124          return $output;
 125      }
 126  }


Generated: Mon Nov 25 19:05:08 2024 Cross-referenced by PHPXref 0.7.1