[ Index ]

PHP Cross Reference of phpBB-3.3.11-deutsch

title

Body

[close]

/vendor/zendframework/zend-code/src/Generator/DocBlock/Tag/ -> LicenseTag.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\AbstractGenerator;
  13  use Zend\Code\Generator\DocBlock\TagManager;
  14  use Zend\Code\Reflection\DocBlock\Tag\TagInterface as ReflectionTagInterface;
  15  
  16  class LicenseTag extends AbstractGenerator implements TagInterface
  17  {
  18      /**
  19       * @var string
  20       */
  21      protected $url;
  22  
  23      /**
  24       * @var string
  25       */
  26      protected $licenseName;
  27  
  28      /**
  29       * @param string $url
  30       * @param string $licenseName
  31       */
  32      public function __construct($url = null, $licenseName = null)
  33      {
  34          if (! empty($url)) {
  35              $this->setUrl($url);
  36          }
  37  
  38          if (! empty($licenseName)) {
  39              $this->setLicenseName($licenseName);
  40          }
  41      }
  42  
  43      /**
  44       * @param ReflectionTagInterface $reflectionTag
  45       * @return ReturnTag
  46       * @deprecated Deprecated in 2.3. Use TagManager::createTagFromReflection() instead
  47       */
  48      public static function fromReflection(ReflectionTagInterface $reflectionTag)
  49      {
  50          $tagManager = new TagManager();
  51          $tagManager->initializeDefaultTags();
  52          return $tagManager->createTagFromReflection($reflectionTag);
  53      }
  54  
  55      /**
  56       * @return string
  57       */
  58      public function getName()
  59      {
  60          return 'license';
  61      }
  62  
  63      /**
  64       * @param string $url
  65       * @return LicenseTag
  66       */
  67      public function setUrl($url)
  68      {
  69          $this->url = $url;
  70          return $this;
  71      }
  72  
  73      /**
  74       * @return string
  75       */
  76      public function getUrl()
  77      {
  78          return $this->url;
  79      }
  80  
  81      /**
  82       * @param  string $name
  83       * @return LicenseTag
  84       */
  85      public function setLicenseName($name)
  86      {
  87          $this->licenseName = $name;
  88          return $this;
  89      }
  90  
  91      /**
  92       * @return string
  93       */
  94      public function getLicenseName()
  95      {
  96          return $this->licenseName;
  97      }
  98  
  99      /**
 100       * @return string
 101       */
 102      public function generate()
 103      {
 104          $output = '@license'
 105              . (! empty($this->url) ? ' ' . $this->url : '')
 106              . (! empty($this->licenseName) ? ' ' . $this->licenseName : '');
 107  
 108          return $output;
 109      }
 110  }


Generated: Sat Nov 4 14:26:03 2023 Cross-referenced by PHPXref 0.7.1