diff options
| author | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-07-27 11:24:43 +0200 |
|---|---|---|
| committer | Tristan Darricau <tristan.darricau@sensiolabs.com> | 2015-07-27 11:24:43 +0200 |
| commit | a0258ae25ce31101241f0873b21e4582cd47a368 (patch) | |
| tree | a828a84d8d57cf1b817e0f5adee83ea6cc288b5d /phpBB/phpbb/di | |
| parent | 0e3b7e2de6e152960026a6533a1150e5fb1135aa (diff) | |
| parent | 11dfe503aac699b88a333967a1d0e594998414ae (diff) | |
| download | forums-a0258ae25ce31101241f0873b21e4582cd47a368.tar forums-a0258ae25ce31101241f0873b21e4582cd47a368.tar.gz forums-a0258ae25ce31101241f0873b21e4582cd47a368.tar.bz2 forums-a0258ae25ce31101241f0873b21e4582cd47a368.tar.xz forums-a0258ae25ce31101241f0873b21e4582cd47a368.zip | |
Merge pull request #3514 from CHItA/ticket/13740
[ticket/13740] Refactoring installer
* CHItA/ticket/13740: (75 commits)
[ticket/13740] Reduce number of references in nav provider
[ticket/13740] Move handle_language_select calls to the controllers
[ticket/13740] Fix infinite config.php check loop
[ticket/13740] Move default data settings out of constructors
[ticket/13740] Deduplicate container builder's checks
[ticket/13740] Use JSON for installer config
[ticket/13740] Fix comment
[ticket/13740] Use language service in console application
[ticket/13740] Fix CS in compatibilty_globals.php
[ticket/13740] Fix message element creation in JS
[ticket/13740] Replace more spaces with tabs
[ticket/13740] Fix CS
[ticket/13740] Filter basic directory change attempts in lang change
[ticket/13740] Use tabs instead of spaces in JS file
[ticket/13740] Add success message when install finished
[ticket/13740] Fix $script_path in obtain_data
[ticket/13740] Fix is_phpbb_installed() method
[ticket/13740] Login admin when install finished
[ticket/13740] Enhance server output buffer bypass
[ticket/13740] Secure installer config against corrupted config data
...
Diffstat (limited to 'phpBB/phpbb/di')
| -rw-r--r-- | phpBB/phpbb/di/pass/collection_pass.php | 13 | ||||
| -rw-r--r-- | phpBB/phpbb/di/service_collection.php | 27 |
2 files changed, 39 insertions, 1 deletions
diff --git a/phpBB/phpbb/di/pass/collection_pass.php b/phpBB/phpbb/di/pass/collection_pass.php index ccc1250c20..341f88518d 100644 --- a/phpBB/phpbb/di/pass/collection_pass.php +++ b/phpBB/phpbb/di/pass/collection_pass.php @@ -34,10 +34,12 @@ class collection_pass implements CompilerPassInterface foreach ($container->findTaggedServiceIds('service_collection') as $id => $data) { $definition = $container->getDefinition($id); + $is_ordered_collection = (substr($definition->getClass(), -strlen('ordered_service_collection')) === 'ordered_service_collection'); + $is_class_name_aware = (isset($data[0]['class_name_aware']) && $data[0]['class_name_aware']); foreach ($container->findTaggedServiceIds($data[0]['tag']) as $service_id => $service_data) { - if (substr($definition->getClass(), -strlen('ordered_service_collection')) === 'ordered_service_collection') + if ($is_ordered_collection) { $arguments = array($service_id, $service_data[0]['order']); } @@ -46,6 +48,15 @@ class collection_pass implements CompilerPassInterface $arguments = array($service_id); } + if ($is_class_name_aware) + { + $service_definition = $container->getDefinition($service_id); + $definition->addMethodCall('add_service_class', array( + $service_id, + $service_definition->getClass() + )); + } + $definition->addMethodCall('add', $arguments); } } diff --git a/phpBB/phpbb/di/service_collection.php b/phpBB/phpbb/di/service_collection.php index 82ca9bf679..8e9175e204 100644 --- a/phpBB/phpbb/di/service_collection.php +++ b/phpBB/phpbb/di/service_collection.php @@ -26,6 +26,11 @@ class service_collection extends \ArrayObject protected $container; /** + * @var array + */ + protected $service_classes; + + /** * Constructor * * @param ContainerInterface $container Container object @@ -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_class($service_id, $class) + { + $this->service_classes[$service_id] = $class; + } + + /** + * Get services' classes + * + * @return array + */ + public function get_service_classes() + { + return $this->service_classes; + } } |
