aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/phpbb/event/extension_subscriber_loader.php
blob: 6408f93e2aa92fedacb58e8ce69d7838125cf090 (plain)
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
<?php
/**
*
* @package phpBB3
* @copyright (c) 2012 phpBB Group
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
*
*/

namespace phpbb\event;

use Symfony\Component\EventDispatcher\EventDispatcherInterface;

class extension_subscriber_loader
{
	private $dispatcher;
	private $listener_collection;

	public function __construct(EventDispatcherInterface $dispatcher, \phpbb\di\service_collection $listener_collection)
	{
		$this->dispatcher = $dispatcher;
		$this->listener_collection = $listener_collection;
	}

	public function load()
	{
		if (!empty($this->listener_collection))
		{
			foreach ($this->listener_collection as $listener)
			{
				$this->dispatcher->addSubscriber($listener);
			}
		}
	}
}