2012-01-07 20:53:04 +01:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
*
|
2014-05-27 20:18:06 +02:00
|
|
|
* This file is part of the phpBB Forum Software package.
|
|
|
|
*
|
|
|
|
* @copyright (c) phpBB Limited <https://www.phpbb.com>
|
|
|
|
* @license GNU General Public License, version 2 (GPL-2.0)
|
|
|
|
*
|
|
|
|
* For full copyright and license information, please see
|
|
|
|
* the docs/CREDITS.txt file.
|
2012-01-07 20:53:04 +01:00
|
|
|
*
|
|
|
|
*/
|
|
|
|
|
2013-09-10 14:01:09 +02:00
|
|
|
namespace phpbb\event;
|
|
|
|
|
2012-03-21 13:09:39 +01:00
|
|
|
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
|
2012-03-11 15:14:13 +01:00
|
|
|
|
2013-09-10 14:01:09 +02:00
|
|
|
class extension_subscriber_loader
|
2012-01-07 20:53:04 +01:00
|
|
|
{
|
|
|
|
private $dispatcher;
|
2013-11-13 17:34:06 +01:00
|
|
|
private $listener_collection;
|
2012-01-07 20:53:04 +01:00
|
|
|
|
2013-11-13 17:34:06 +01:00
|
|
|
public function __construct(EventDispatcherInterface $dispatcher, \phpbb\di\service_collection $listener_collection)
|
2012-01-07 20:53:04 +01:00
|
|
|
{
|
|
|
|
$this->dispatcher = $dispatcher;
|
2013-11-13 17:34:06 +01:00
|
|
|
$this->listener_collection = $listener_collection;
|
2012-01-07 20:53:04 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
public function load()
|
|
|
|
{
|
2013-11-13 17:34:06 +01:00
|
|
|
if (!empty($this->listener_collection))
|
2012-03-29 21:29:56 +02:00
|
|
|
{
|
2013-11-13 17:34:06 +01:00
|
|
|
foreach ($this->listener_collection as $listener)
|
|
|
|
{
|
|
|
|
$this->dispatcher->addSubscriber($listener);
|
|
|
|
}
|
2012-01-07 20:53:04 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|