1
0
mirror of https://github.com/phpbb/phpbb.git synced 2025-02-24 12:03:21 +01:00
php-phpbb/phpBB/phpbb/event/extension_subscriber_loader.php
Joas Schilling d3f9a51709 [ticket/12016] Use a service provider for event listeners
This allows them to use dependency injection

PHPBB3-12016
2013-11-13 17:34:06 +01:00

36 lines
740 B
PHP

<?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);
}
}
}
}