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 |
MethodTag.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 function rtrim;
013
014 class MethodTag extends AbstractTypeableTag implements TagInterface
015 {
016 /**
017 * @var string
018 */
019 protected $methodName;
020
021 /**
022 * @var bool
023 */
024 protected $isStatic = false;
025
026 /**
027 * @param string $methodName
028 * @param array $types
029 * @param string $description
030 * @param bool $isStatic
031 */
032 public function __construct($methodName = null, $types = [], $description = null, $isStatic = false)
033 {
034 if (! empty($methodName)) {
035 $this->setMethodName($methodName);
036 }
037
038 $this->setIsStatic((bool) $isStatic);
039
040 parent::__construct($types, $description);
041 }
042
043 /**
044 * @return string
045 */
046 public function getName()
047 {
048 return 'method';
049 }
050
051 /**
052 * @param bool $isStatic
053 * @return MethodTag
054 */
055 public function setIsStatic($isStatic)
056 {
057 $this->isStatic = $isStatic;
058 return $this;
059 }
060
061 /**
062 * @return bool
063 */
064 public function isStatic()
065 {
066 return $this->isStatic;
067 }
068
069 /**
070 * @param string $methodName
071 * @return MethodTag
072 */
073 public function setMethodName($methodName)
074 {
075 $this->methodName = rtrim($methodName, ')(');
076 return $this;
077 }
078
079 /**
080 * @return string
081 */
082 public function getMethodName()
083 {
084 return $this->methodName;
085 }
086
087 /**
088 * @return string
089 */
090 public function generate()
091 {
092 $output = '@method'
093 . ($this->isStatic ? ' static' : '')
094 . (! empty($this->types) ? ' ' . $this->getTypesAsString() : '')
095 . (! empty($this->methodName) ? ' ' . $this->methodName . '()' : '')
096 . (! empty($this->description) ? ' ' . $this->description : '');
097
098 return $output;
099 }
100 }
101