aboutsummaryrefslogtreecommitdiffstats
path: root/phpBB/includes/cron/task/collection.php
diff options
context:
space:
mode:
Diffstat (limited to 'phpBB/includes/cron/task/collection.php')
-rw-r--r--phpBB/includes/cron/task/collection.php51
1 files changed, 14 insertions, 37 deletions
diff --git a/phpBB/includes/cron/task/collection.php b/phpBB/includes/cron/task/collection.php
index d05be9012c..84607dc28d 100644
--- a/phpBB/includes/cron/task/collection.php
+++ b/phpBB/includes/cron/task/collection.php
@@ -15,58 +15,35 @@ if (!defined('IN_PHPBB'))
exit;
}
+use Symfony\Component\DependencyInjection\TaggedContainerInterface;
+
/**
* Collects cron tasks
*
* @package phpBB3
*/
-class phpbb_cron_task_collection implements ArrayAccess
+class phpbb_cron_task_collection extends ArrayObject
{
/**
- * ArrayAccess method
- *
- * @param mixed $offset Array offset
- */
- public function offsetExists($offset)
- {
- return isset($this->tasks[$offset]);
- }
-
- /**
- * ArrayAccess method
- *
- * @param mixed $offset Array offset
- */
- public function offsetGet($offset)
- {
- return $this->offsetExists($offset) ? $this->tasks[$offset] : null;
- }
-
- /**
- * ArrayAccess method
+ * Constructor
*
- * @param mixed $offset Array offset
- * @param mixed $value New value
+ * @param TaggedContainerInterface $container Container object
*/
- public function offsetSet($offset, $value)
+ public function __construct(TaggedContainerInterface $container)
{
- if ($offset === null)
- {
- $this->tasks[] = $value;
- }
- else
- {
- $this->tasks[$offset] = $value;
- }
+ $this->container = $container;
}
/**
- * ArrayAccess method
+ * Add a cron task to the collection
*
- * @param mixed $offset Array offset
+ * @param string $name The service name of the cron task
+ * @return null
*/
- public function offsetUnset($offset)
+ public function add($name)
{
- $this->tasks[$offset] = null;
+ $task = $this->container->get($name);
+ $task->set_name($name);
+ $this->offsetSet($name, $task);
}
}