diff options
Diffstat (limited to 'phpBB')
-rw-r--r-- | phpBB/config/services.yml | 1 | ||||
-rw-r--r-- | phpBB/phpbb/avatar/manager.php | 30 |
2 files changed, 19 insertions, 12 deletions
diff --git a/phpBB/config/services.yml b/phpBB/config/services.yml index c6490a21d7..7e3202d86b 100644 --- a/phpBB/config/services.yml +++ b/phpBB/config/services.yml @@ -22,7 +22,6 @@ services: arguments: - @config - @avatar.driver_collection - - @service_container cache: class: phpbb\cache\service diff --git a/phpBB/phpbb/avatar/manager.php b/phpBB/phpbb/avatar/manager.php index c28380a401..7c26bce5ae 100644 --- a/phpBB/phpbb/avatar/manager.php +++ b/phpBB/phpbb/avatar/manager.php @@ -42,12 +42,6 @@ class manager protected $avatar_drivers; /** - * Service container object - * @var object - */ - protected $container; - - /** * Default avatar data row * @var array */ @@ -63,13 +57,27 @@ class manager * * @param \phpbb\config\config $config phpBB configuration * @param array $avatar_drivers Avatar drivers passed via the service container - * @param object $container Container object */ - public function __construct(\phpbb\config\config $config, $avatar_drivers, $container) + public function __construct(\phpbb\config\config $config, $avatar_drivers) { $this->config = $config; - $this->avatar_drivers = $avatar_drivers; - $this->container = $container; + $this->register_avatar_drivers($avatar_drivers); + } + + /** + * Register avatar drivers + * + * @param array $avatar_drivers Service collection of avatar drivers + */ + protected function register_avatar_drivers($avatar_drivers) + { + if (!empty($avatar_drivers)) + { + foreach ($avatar_drivers as $driver) + { + $this->avatar_drivers[$driver->get_name()] = $driver; + } + } } /** @@ -112,7 +120,7 @@ class manager * There is no need to handle invalid avatar types as the following code * will cause a ServiceNotFoundException if the type does not exist */ - $driver = $this->container->get($avatar_type); + $driver = $this->avatar_drivers[$avatar_type]; return $driver; } |