mirror of
https://github.com/phpbb/phpbb.git
synced 2025-08-06 16:56:44 +02:00
[ticket/11152] Convert cron_task_collection to generic di_service_collection
PHPBB3-11152
This commit is contained in:
49
phpBB/includes/di/service_collection.php
Normal file
49
phpBB/includes/di/service_collection.php
Normal file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
/**
|
||||
*
|
||||
* @package phpBB3
|
||||
* @copyright (c) 2011 phpBB Group
|
||||
* @license http://opensource.org/licenses/gpl-2.0.php GNU General Public License v2
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ignore
|
||||
*/
|
||||
if (!defined('IN_PHPBB'))
|
||||
{
|
||||
exit;
|
||||
}
|
||||
|
||||
use Symfony\Component\DependencyInjection\ContainerInterface;
|
||||
|
||||
/**
|
||||
* Collection of services to be configured at container compile time.
|
||||
*
|
||||
* @package phpBB3
|
||||
*/
|
||||
class phpbb_di_service_collection extends ArrayObject
|
||||
{
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param ContainerInterface $container Container object
|
||||
*/
|
||||
public function __construct(ContainerInterface $container)
|
||||
{
|
||||
$this->container = $container;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a service to the collection
|
||||
*
|
||||
* @param string $name The service name
|
||||
* @return null
|
||||
*/
|
||||
public function add($name)
|
||||
{
|
||||
$task = $this->container->get($name);
|
||||
$task->set_name($name);
|
||||
$this->offsetSet($name, $task);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user