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