Verzeichnisstruktur phpBB-3.3.15


Veröffentlicht
28.08.2024

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