Verzeichnisstruktur phpBB-3.3.16


Veröffentlicht
27.04.2026

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

AnnotationManager.php

Zuletzt modifiziert: 01.05.2026, 11:27 - Dateigröße: 2.95 KiB


 001  <?php
 002  /**
 003   * Zend Framework (http://framework.zend.com/)
 004   *
 005   * @link      http://github.com/zendframework/zf2 for the canonical source repository
 006   * @copyright Copyright (c) 2005-2016 Zend Technologies USA Inc. (http://www.zend.com)
 007   * @license   http://framework.zend.com/license/new-bsd New BSD License
 008   */
 009   
 010  namespace Zend\Code\Annotation;
 011   
 012  use Zend\Code\Annotation\Parser\ParserInterface;
 013  use Zend\EventManager\Event;
 014  use Zend\EventManager\EventManager;
 015  use Zend\EventManager\EventManagerAwareInterface;
 016  use Zend\EventManager\EventManagerInterface;
 017   
 018  use function get_class;
 019  use function is_object;
 020   
 021  /**
 022   * Pluggable annotation manager
 023   *
 024   * Simply composes an EventManager. When createAnnotation() is called, it fires
 025   * off an event of the same name, passing it the resolved annotation class, the
 026   * annotation content, and the raw annotation string; the first listener to
 027   * return an object will halt execution of the event, and that object will be
 028   * returned as the annotation.
 029   */
 030  class AnnotationManager implements EventManagerAwareInterface
 031  {
 032      const EVENT_CREATE_ANNOTATION = 'createAnnotation';
 033   
 034      /**
 035       * @var EventManagerInterface
 036       */
 037      protected $events;
 038   
 039      /**
 040       * Set the event manager instance
 041       *
 042       * @param  EventManagerInterface $events
 043       * @return AnnotationManager
 044       */
 045      public function setEventManager(EventManagerInterface $events)
 046      {
 047          $events->setIdentifiers([
 048              __CLASS__,
 049              get_class($this),
 050          ]);
 051          $this->events = $events;
 052   
 053          return $this;
 054      }
 055   
 056      /**
 057       * Retrieve event manager
 058       *
 059       * Lazy loads an instance if none registered.
 060       *
 061       * @return EventManagerInterface
 062       */
 063      public function getEventManager()
 064      {
 065          if (null === $this->events) {
 066              $this->setEventManager(new EventManager());
 067          }
 068   
 069          return $this->events;
 070      }
 071   
 072      /**
 073       * Attach a parser to listen to the createAnnotation event
 074       *
 075       * @param  ParserInterface $parser
 076       * @return AnnotationManager
 077       */
 078      public function attach(ParserInterface $parser)
 079      {
 080          $this->getEventManager()
 081               ->attach(self::EVENT_CREATE_ANNOTATION, [$parser, 'onCreateAnnotation']);
 082   
 083          return $this;
 084      }
 085   
 086      /**
 087       * Create Annotation
 088       *
 089       * @param  string[] $annotationData
 090       * @return false|\stdClass
 091       */
 092      public function createAnnotation(array $annotationData)
 093      {
 094          $event = new Event();
 095          $event->setName(self::EVENT_CREATE_ANNOTATION);
 096          $event->setTarget($this);
 097          $event->setParams([
 098              'class'   => $annotationData[0],
 099              'content' => $annotationData[1],
 100              'raw'     => $annotationData[2],
 101          ]);
 102   
 103          $eventManager = $this->getEventManager();
 104          $results = $eventManager->triggerEventUntil(function ($r) {
 105              return is_object($r);
 106          }, $event);
 107   
 108          $annotation = $results->last();
 109   
 110          return is_object($annotation) ? $annotation : false;
 111      }
 112  }
 113