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

LazyEventListener.php

Zuletzt modifiziert: 02.04.2025, 15:02 - Dateigröße: 2.07 KiB


01  <?php
02  /**
03   * Zend Framework (http://framework.zend.com/)
04   *
05   * @link      http://github.com/zendframework/zend-eventmanager for the canonical source repository
06   * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
07   * @license   https://github.com/zendframework/zend-eventmanager/blob/master/LICENSE.md
08   */
09   
10  namespace Zend\EventManager;
11   
12  use Interop\Container\ContainerInterface;
13   
14  /**
15   * Lazy listener instance for use with LazyListenerAggregate.
16   *
17   * Used as an internal class for the LazyAggregate to allow lazy creation of
18   * listeners via a dependency injection container.
19   *
20   * Lazy event listener definitions add the following members to what the
21   * LazyListener accepts:
22   *
23   * - event: the event name to attach to.
24   * - priority: the priority at which to attach the listener, if not the default.
25   */
26  class LazyEventListener extends LazyListener
27  {
28      /**
29       * @var string Event name to which to attach.
30       */
31      private $event;
32   
33      /**
34       * @var null|int Priority at which to attach.
35       */
36      private $priority;
37   
38      /**
39       * @param array $definition
40       * @param ContainerInterface $container
41       * @param array $env
42       */
43      public function __construct(array $definition, ContainerInterface $container, array $env = [])
44      {
45          parent::__construct($definition, $container, $env);
46   
47          if ((! isset($definition['event'])
48              || ! is_string($definition['event'])
49              || empty($definition['event']))
50          ) {
51              throw new Exception\InvalidArgumentException(
52                  'Lazy listener definition is missing a valid "event" member; cannot create LazyListener'
53              );
54          }
55   
56          $this->event     = $definition['event'];
57          $this->priority  = isset($definition['priority']) ? (int) $definition['priority'] : null;
58      }
59   
60      /**
61       * @return string
62       */
63      public function getEvent()
64      {
65          return $this->event;
66      }
67   
68      /**
69       * @return int
70       */
71      public function getPriority($default = 1)
72      {
73          return (null !== $this->priority) ? $this->priority : $default;
74      }
75  }
76