From b284e31a9e55e5fc617a229439282cc6d746432a Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 15:29:49 +0200 Subject: [ticket/13740] Add option to have class names in service collections PHPBB3-13740 --- phpBB/phpbb/di/service_collection.php | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'phpBB/phpbb/di/service_collection.php') diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php index 82ca9bf679..24f358ca84 100644 --- a/phpBB/phpbb/di/service_collection.php +++ b/phpBB/phpbb/di/service_collection.php @@ -25,6 +25,11 @@ class service_collection extends \ArrayObject */ protected $container; + /** + * @var array + */ + protected $service_classes; + /** * Constructor * @@ -33,6 +38,7 @@ class service_collection extends \ArrayObject public function __construct(ContainerInterface $container) { $this->container = $container; + $this->service_classes = array(); } /** @@ -76,4 +82,25 @@ class service_collection extends \ArrayObject { $this->offsetSet($name, null); } + + /** + * Add a service's class to the collection + * + * @param string $service_id + * @param string $class + */ + public function add_service_classes($service_id, $class) + { + $this->service_classes[$service_id] = $class; + } + + /** + * Get services' classes + * + * @return array + */ + public function get_service_classes() + { + return $this->service_classes; + } } -- cgit v1.2.1 From e967f3c1a81eab0f14daf314b7fb1b2001e4d220 Mon Sep 17 00:00:00 2001 From: Mate Bartus Date: Thu, 9 Jul 2015 19:08:28 +0200 Subject: [ticket/13740] Fix itteration problems, implement class name aware collections PHPBB3-13740 --- phpBB/phpbb/di/service_collection.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'phpBB/phpbb/di/service_collection.php') diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php index 24f358ca84..8e9175e204 100644 --- a/phpBB/phpbb/di/service_collection.php +++ b/phpBB/phpbb/di/service_collection.php @@ -89,7 +89,7 @@ class service_collection extends \ArrayObject * @param string $service_id * @param string $class */ - public function add_service_classes($service_id, $class) + public function add_service_class($service_id, $class) { $this->service_classes[$service_id] = $class; } -- cgit v1.2.1