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

TagManager.php

Zuletzt modifiziert: 09.10.2024, 12:58 - Dateigröße: 2.56 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;
 11   
 12  use Zend\Code\Generator\DocBlock\Tag\TagInterface;
 13  use Zend\Code\Generic\Prototype\PrototypeClassFactory;
 14  use Zend\Code\Reflection\DocBlock\Tag\TagInterface as ReflectionTagInterface;
 15   
 16  /**
 17   * This class is used in DocBlockGenerator and creates the needed
 18   * Tag classes depending on the tag. So for example an @author tag
 19   * will trigger the creation of an AuthorTag class.
 20   *
 21   * If none of the classes is applicable, the GenericTag class will be
 22   * created
 23   */
 24  class TagManager extends PrototypeClassFactory
 25  {
 26      /**
 27       * @return void
 28       */
 29      public function initializeDefaultTags()
 30      {
 31          $this->addPrototype(new Tag\ParamTag());
 32          $this->addPrototype(new Tag\ReturnTag());
 33          $this->addPrototype(new Tag\MethodTag());
 34          $this->addPrototype(new Tag\PropertyTag());
 35          $this->addPrototype(new Tag\AuthorTag());
 36          $this->addPrototype(new Tag\LicenseTag());
 37          $this->addPrototype(new Tag\ThrowsTag());
 38          $this->setGenericPrototype(new Tag\GenericTag());
 39      }
 40   
 41      /**
 42       * @param ReflectionTagInterface $reflectionTag
 43       * @return TagInterface
 44       */
 45      public function createTagFromReflection(ReflectionTagInterface $reflectionTag)
 46      {
 47          $tagName = $reflectionTag->getName();
 48   
 49          /* @var TagInterface $newTag */
 50          $newTag = $this->getClonedPrototype($tagName);
 51   
 52          // transport any properties via accessors and mutators from reflection to codegen object
 53          $reflectionClass = new \ReflectionClass($reflectionTag);
 54          foreach ($reflectionClass->getMethods(\ReflectionMethod::IS_PUBLIC) as $method) {
 55              if (substr($method->getName(), 0, 3) == 'get') {
 56                  $propertyName = substr($method->getName(), 3);
 57                  if (method_exists($newTag, 'set' . $propertyName)) {
 58                      $newTag->{'set' . $propertyName}($reflectionTag->{'get' . $propertyName}());
 59                  }
 60              } elseif (substr($method->getName(), 0, 2) == 'is') {
 61                  $propertyName = ucfirst($method->getName());
 62                  if (method_exists($newTag, 'set' . $propertyName)) {
 63                      $newTag->{'set' . $propertyName}($reflectionTag->{$method->getName()}());
 64                  }
 65              }
 66          }
 67          return $newTag;
 68      }
 69  }
 70