[ Index ]

PHP Cross Reference of phpBB-3.3.7-deutsch

title

Body

[close]

/vendor/zendframework/zend-code/src/Generator/DocBlock/Tag/ -> AuthorTag.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 AuthorTag extends AbstractGenerator implements TagInterface
  17  {
  18      /**
  19       * @var string
  20       */
  21      protected $authorName;
  22  
  23      /**
  24       * @var string
  25       */
  26      protected $authorEmail;
  27  
  28      /**
  29       * @param string $authorName
  30       * @param string $authorEmail
  31       */
  32      public function __construct($authorName = null, $authorEmail = null)
  33      {
  34          if (! empty($authorName)) {
  35              $this->setAuthorName($authorName);
  36          }
  37  
  38          if (! empty($authorEmail)) {
  39              $this->setAuthorEmail($authorEmail);
  40          }
  41      }
  42  
  43      /**
  44       * @param ReflectionTagInterface $reflectionTag
  45       * @return AuthorTag
  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 'author';
  61      }
  62  
  63      /**
  64       * @param string $authorEmail
  65       * @return AuthorTag
  66       */
  67      public function setAuthorEmail($authorEmail)
  68      {
  69          $this->authorEmail = $authorEmail;
  70          return $this;
  71      }
  72  
  73      /**
  74       * @return string
  75       */
  76      public function getAuthorEmail()
  77      {
  78          return $this->authorEmail;
  79      }
  80  
  81      /**
  82       * @param string $authorName
  83       * @return AuthorTag
  84       */
  85      public function setAuthorName($authorName)
  86      {
  87          $this->authorName = $authorName;
  88          return $this;
  89      }
  90  
  91      /**
  92       * @return string
  93       */
  94      public function getAuthorName()
  95      {
  96          return $this->authorName;
  97      }
  98  
  99      /**
 100       * @return string
 101       */
 102      public function generate()
 103      {
 104          $output = '@author'
 105              . (! empty($this->authorName) ? ' ' . $this->authorName : '')
 106              . (! empty($this->authorEmail) ? ' <' . $this->authorEmail . '>' : '');
 107  
 108          return $output;
 109      }
 110  }


Generated: Thu Mar 24 21:31:15 2022 Cross-referenced by PHPXref 0.7.1