Skip to content

Commit 9fa2959

Browse files
authored
Merge pull request #241 from BR0kEN-/symfony-compatibility
Symfony compatibility: remove wrongly overridden "load()" method but preserve the logic
2 parents b3c3e20 + 0f56dd5 commit 9fa2959

File tree

1 file changed

+10
-21
lines changed

1 file changed

+10
-21
lines changed

src/JonnyW/PhantomJs/DependencyInjection/ServiceContainer.php

+10-21
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ServiceContainer extends ContainerBuilder
2222
/**
2323
* Service container instance
2424
*
25-
* @var \JonnyW\PhantomJs\DependencyInjection\ServiceContainer
25+
* @var static
2626
* @access private
2727
*/
2828
private static $instance;
@@ -31,32 +31,21 @@ class ServiceContainer extends ContainerBuilder
3131
* Get singleton instance
3232
*
3333
* @access public
34-
* @return \JonnyW\PhantomJs\Client
34+
* @return static
3535
*/
3636
public static function getInstance()
3737
{
38-
if (!self::$instance instanceof ServiceContainer) {
38+
if (null === self::$instance) {
39+
self::$instance = new static();
3940

40-
self::$instance = new ServiceContainer();
41-
self::$instance->load();
41+
$loader = new YamlFileLoader(self::$instance, new FileLocator(__DIR__.'/../Resources/config'));
42+
$loader->load('config.yml');
43+
$loader->load('services.yml');
44+
45+
self::$instance->setParameter('phantomjs.cache_dir', sys_get_temp_dir());
46+
self::$instance->setParameter('phantomjs.resource_dir', __DIR__.'/../Resources');
4247
}
4348

4449
return self::$instance;
4550
}
46-
47-
/**
48-
* Load service container.
49-
*
50-
* @access public
51-
* @return void
52-
*/
53-
public function load()
54-
{
55-
$loader = new YamlFileLoader($this, new FileLocator(__DIR__.'/../Resources/config'));
56-
$loader->load('config.yml');
57-
$loader->load('services.yml');
58-
59-
$this->setParameter('phantomjs.cache_dir', sys_get_temp_dir());
60-
$this->setParameter('phantomjs.resource_dir', __DIR__.'/../Resources');
61-
}
6251
}

0 commit comments

Comments
 (0)