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

GlobalEventManager.php

Zuletzt modifiziert: 09.10.2024, 12:55 - Dateigröße: 3.58 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-2015 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\EventManager;
 011   
 012  use Zend\Stdlib\CallbackHandler;
 013  use Zend\Stdlib\PriorityQueue;
 014   
 015  /**
 016   * Event manager: notification system
 017   *
 018   * Use the EventManager when you want to create a per-instance notification
 019   * system for your objects.
 020   */
 021  class GlobalEventManager
 022  {
 023      /**
 024       * @var EventManagerInterface
 025       */
 026      protected static $events;
 027   
 028      /**
 029       * Set the event collection on which this will operate
 030       *
 031       * @param  null|EventManagerInterface $events
 032       * @return void
 033       */
 034      public static function setEventCollection(EventManagerInterface $events = null)
 035      {
 036          static::$events = $events;
 037      }
 038   
 039      /**
 040       * Get event collection on which this operates
 041       *
 042       * @return EventManagerInterface
 043       */
 044      public static function getEventCollection()
 045      {
 046          if (null === static::$events) {
 047              static::setEventCollection(new EventManager());
 048          }
 049          return static::$events;
 050      }
 051   
 052      /**
 053       * Trigger an event
 054       *
 055       * @param  string        $event
 056       * @param  object|string $context
 057       * @param  array|object  $argv
 058       * @param  null|callable $callback
 059       * @return ResponseCollection
 060       */
 061      public static function trigger($event, $context, $argv = array(), $callback = null)
 062      {
 063          return static::getEventCollection()->trigger($event, $context, $argv, $callback);
 064      }
 065   
 066      /**
 067       * Trigger listeners until return value of one causes a callback to evaluate
 068       * to true.
 069       *
 070       * @param  string $event
 071       * @param  string|object $context
 072       * @param  array|object $argv
 073       * @param  callable $callback
 074       * @return ResponseCollection
 075       * @deprecated Please use trigger()
 076       */
 077      public static function triggerUntil($event, $context, $argv, $callback)
 078      {
 079          trigger_error(
 080              'This method is deprecated and will be removed in the future. Please use trigger() instead.',
 081              E_USER_DEPRECATED
 082          );
 083          return static::trigger($event, $context, $argv, $callback);
 084      }
 085   
 086      /**
 087       * Attach a listener to an event
 088       *
 089       * @param  string $event
 090       * @param  callable $callback
 091       * @param  int $priority
 092       * @return CallbackHandler
 093       */
 094      public static function attach($event, $callback, $priority = 1)
 095      {
 096          return static::getEventCollection()->attach($event, $callback, $priority);
 097      }
 098   
 099      /**
 100       * Detach a callback from a listener
 101       *
 102       * @param  CallbackHandler $listener
 103       * @return bool
 104       */
 105      public static function detach(CallbackHandler $listener)
 106      {
 107          return static::getEventCollection()->detach($listener);
 108      }
 109   
 110      /**
 111       * Retrieve list of events this object manages
 112       *
 113       * @return array
 114       */
 115      public static function getEvents()
 116      {
 117          return static::getEventCollection()->getEvents();
 118      }
 119   
 120      /**
 121       * Retrieve all listeners for a given event
 122       *
 123       * @param  string $event
 124       * @return PriorityQueue|array
 125       */
 126      public static function getListeners($event)
 127      {
 128          return static::getEventCollection()->getListeners($event);
 129      }
 130   
 131      /**
 132       * Clear all listeners for a given event
 133       *
 134       * @param  string $event
 135       * @return void
 136       */
 137      public static function clearListeners($event)
 138      {
 139          static::getEventCollection()->clearListeners($event);
 140      }
 141  }
 142