From 0f56dd5aae630324dfbc95b55407589ff41305a3 Mon Sep 17 00:00:00 2001 From: Sergii Bondarenko Date: Wed, 7 Mar 2018 13:47:02 +0200 Subject: [PATCH] Remove wrongly overridden "load()" method but preserve the logic --- .../DependencyInjection/ServiceContainer.php | 31 ++++++------------- 1 file changed, 10 insertions(+), 21 deletions(-) diff --git a/src/JonnyW/PhantomJs/DependencyInjection/ServiceContainer.php b/src/JonnyW/PhantomJs/DependencyInjection/ServiceContainer.php index 1b4d586..3340d80 100644 --- a/src/JonnyW/PhantomJs/DependencyInjection/ServiceContainer.php +++ b/src/JonnyW/PhantomJs/DependencyInjection/ServiceContainer.php @@ -22,7 +22,7 @@ class ServiceContainer extends ContainerBuilder /** * Service container instance * - * @var \JonnyW\PhantomJs\DependencyInjection\ServiceContainer + * @var static * @access private */ private static $instance; @@ -31,32 +31,21 @@ class ServiceContainer extends ContainerBuilder * Get singleton instance * * @access public - * @return \JonnyW\PhantomJs\Client + * @return static */ public static function getInstance() { - if (!self::$instance instanceof ServiceContainer) { + if (null === self::$instance) { + self::$instance = new static(); - self::$instance = new ServiceContainer(); - self::$instance->load(); + $loader = new YamlFileLoader(self::$instance, new FileLocator(__DIR__.'/../Resources/config')); + $loader->load('config.yml'); + $loader->load('services.yml'); + + self::$instance->setParameter('phantomjs.cache_dir', sys_get_temp_dir()); + self::$instance->setParameter('phantomjs.resource_dir', __DIR__.'/../Resources'); } return self::$instance; } - - /** - * Load service container. - * - * @access public - * @return void - */ - public function load() - { - $loader = new YamlFileLoader($this, new FileLocator(__DIR__.'/../Resources/config')); - $loader->load('config.yml'); - $loader->load('services.yml'); - - $this->setParameter('phantomjs.cache_dir', sys_get_temp_dir()); - $this->setParameter('phantomjs.resource_dir', __DIR__.'/../Resources'); - } }