Verzeichnisstruktur phpBB-3.2.0


Veröffentlicht
06.01.2017

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.
Auf den Verzeichnisnamen klicken, dies zeigt nur das Verzeichnis mit Inhalt an

      (Beispiel Datei-Icons)

Auf das Icon klicken um den Quellcode anzuzeigen

MethodTag.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 2.13 KiB


 01  <?php
 02  /**
 03   * Zend Framework (http://framework.zend.com/)
 04   *
 05   * @link      http://github.com/zendframework/zf2 for the canonical source repository
 06   * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
 07   * @license   http://framework.zend.com/license/new-bsd New BSD License
 08   */
 09   
 10  namespace Zend\Code\Generator\DocBlock\Tag;
 11   
 12  class MethodTag extends AbstractTypeableTag implements TagInterface
 13  {
 14      /**
 15       * @var string
 16       */
 17      protected $methodName = null;
 18   
 19      /**
 20       * @var bool
 21       */
 22      protected $isStatic = false;
 23   
 24      /**
 25       * @param string $methodName
 26       * @param array $types
 27       * @param string $description
 28       * @param bool $isStatic
 29       */
 30      public function __construct($methodName = null, $types = array(), $description = null, $isStatic = false)
 31      {
 32          if (!empty($methodName)) {
 33              $this->setMethodName($methodName);
 34          }
 35   
 36          $this->setIsStatic((bool) $isStatic);
 37   
 38          parent::__construct($types, $description);
 39      }
 40   
 41      /**
 42       * @return string
 43       */
 44      public function getName()
 45      {
 46          return 'method';
 47      }
 48   
 49      /**
 50       * @param boolean $isStatic
 51       * @return MethodTag
 52       */
 53      public function setIsStatic($isStatic)
 54      {
 55          $this->isStatic = $isStatic;
 56          return $this;
 57      }
 58   
 59      /**
 60       * @return boolean
 61       */
 62      public function isStatic()
 63      {
 64          return $this->isStatic;
 65      }
 66   
 67      /**
 68       * @param string $methodName
 69       * @return MethodTag
 70       */
 71      public function setMethodName($methodName)
 72      {
 73          $this->methodName = rtrim($methodName, ')(');
 74          return $this;
 75      }
 76   
 77      /**
 78       * @return string
 79       */
 80      public function getMethodName()
 81      {
 82          return $this->methodName;
 83      }
 84   
 85      /**
 86       * @return string
 87       */
 88      public function generate()
 89      {
 90          $output = '@method'
 91              . (($this->isStatic) ? ' static' : '')
 92              . ((!empty($this->types)) ? ' ' . $this->getTypesAsString() : '')
 93              . ((!empty($this->methodName)) ? ' ' . $this->methodName . '()' : '')
 94              . ((!empty($this->description)) ? ' ' . $this->description : '');
 95   
 96          return $output;
 97      }
 98  }
 99