Verzeichnisstruktur phpBB-3.3.15
- Veröffentlicht
- 28.08.2024
So funktioniert es
|
Auf das letzte Element klicken. Dies geht jeweils ein Schritt zurück |
Auf das Icon klicken, dies öffnet das Verzeichnis. Nochmal klicken schließt das Verzeichnis. |
|
(Beispiel Datei-Icons)
|
Auf das Icon klicken um den Quellcode anzuzeigen |
ParamTag.php
001 <?php
002 /**
003 * Zend Framework (http://framework.zend.com/)
004 *
005 * @link http://github.com/zendframework/zf2 for the canonical source repository
006 * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
007 * @license http://framework.zend.com/license/new-bsd New BSD License
008 */
009
010 namespace Zend\Code\Generator\DocBlock\Tag;
011
012 use Zend\Code\Generator\DocBlock\TagManager;
013 use Zend\Code\Reflection\DocBlock\Tag\TagInterface as ReflectionTagInterface;
014
015 use function ltrim;
016
017 class ParamTag extends AbstractTypeableTag implements TagInterface
018 {
019 /**
020 * @var string
021 */
022 protected $variableName;
023
024 /**
025 * @param string $variableName
026 * @param array $types
027 * @param string $description
028 */
029 public function __construct($variableName = null, $types = [], $description = null)
030 {
031 if (! empty($variableName)) {
032 $this->setVariableName($variableName);
033 }
034
035 parent::__construct($types, $description);
036 }
037
038 /**
039 * @param ReflectionTagInterface $reflectionTag
040 * @return ParamTag
041 * @deprecated Deprecated in 2.3. Use TagManager::createTagFromReflection() instead
042 */
043 public static function fromReflection(ReflectionTagInterface $reflectionTag)
044 {
045 $tagManager = new TagManager();
046 $tagManager->initializeDefaultTags();
047 return $tagManager->createTagFromReflection($reflectionTag);
048 }
049
050 /**
051 * @return string
052 */
053 public function getName()
054 {
055 return 'param';
056 }
057
058 /**
059 * @param string $variableName
060 * @return ParamTag
061 */
062 public function setVariableName($variableName)
063 {
064 $this->variableName = ltrim($variableName, '$');
065 return $this;
066 }
067
068 /**
069 * @return string
070 */
071 public function getVariableName()
072 {
073 return $this->variableName;
074 }
075
076 /**
077 * @param string $datatype
078 * @return ParamTag
079 * @deprecated Deprecated in 2.3. Use setTypes() instead
080 */
081 public function setDatatype($datatype)
082 {
083 return $this->setTypes($datatype);
084 }
085
086 /**
087 * @return string
088 * @deprecated Deprecated in 2.3. Use getTypes() or getTypesAsString() instead
089 */
090 public function getDatatype()
091 {
092 return $this->getTypesAsString();
093 }
094
095 /**
096 * @param string $paramName
097 * @return ParamTag
098 * @deprecated Deprecated in 2.3. Use setVariableName() instead
099 */
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 }
127