[ Index ]

PHP Cross Reference of phpBB-3.2.11-deutsch

title

Body

[close]

/vendor/zendframework/zend-code/src/Generator/DocBlock/Tag/ -> PropertyTag.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-2015 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  class PropertyTag extends AbstractTypeableTag implements TagInterface
  13  {
  14      /**
  15       * @var string
  16       */
  17      protected $propertyName = null;
  18  
  19      /**
  20       * @param string $propertyName
  21       * @param array $types
  22       * @param string $description
  23       */
  24      public function __construct($propertyName = null, $types = array(), $description = null)
  25      {
  26          if (!empty($propertyName)) {
  27              $this->setPropertyName($propertyName);
  28          }
  29  
  30          parent::__construct($types, $description);
  31      }
  32  
  33      /**
  34       * @return string
  35       */
  36      public function getName()
  37      {
  38          return 'property';
  39      }
  40  
  41      /**
  42       * @param string $propertyName
  43       * @return self
  44       */
  45      public function setPropertyName($propertyName)
  46      {
  47          $this->propertyName = ltrim($propertyName, '$');
  48          return $this;
  49      }
  50  
  51      /**
  52       * @return string
  53       */
  54      public function getPropertyName()
  55      {
  56          return $this->propertyName;
  57      }
  58  
  59      /**
  60       * @return string
  61       */
  62      public function generate()
  63      {
  64          $output = '@property'
  65              . ((!empty($this->types)) ? ' ' . $this->getTypesAsString() : '')
  66              . ((!empty($this->propertyName)) ? ' $' . $this->propertyName : '')
  67              . ((!empty($this->description)) ? ' ' . $this->description : '');
  68  
  69          return $output;
  70      }
  71  }


Generated: Wed Nov 11 20:33:01 2020 Cross-referenced by PHPXref 0.7.1