DelegatingDispatcher.php
1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
/**
* Part of the Joomla Framework Event Package
*
* @copyright Copyright (C) 2005 - 2019 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
namespace Joomla\Event;
/**
* A dispatcher delegating its methods to an other dispatcher.
*
* @since 1.0
* @deprecated 2.0 Create your own delegating (decorating) dispatcher as needed.
*/
final class DelegatingDispatcher implements DispatcherInterface
{
/**
* The delegated dispatcher.
*
* @var DispatcherInterface
* @since 1.0
*/
private $dispatcher;
/**
* Constructor.
*
* @param DispatcherInterface $dispatcher The delegated dispatcher.
*
* @since 1.0
*/
public function __construct(DispatcherInterface $dispatcher)
{
$this->dispatcher = $dispatcher;
}
/**
* Trigger an event.
*
* @param EventInterface|string $event The event object or name.
*
* @return EventInterface The event after being passed through all listeners.
*
* @since 1.0
*/
public function triggerEvent($event)
{
return $this->dispatcher->triggerEvent($event);
}
}