Skip to content

Commit

Permalink
Merge pull request #241 from BR0kEN-/symfony-compatibility
Browse files Browse the repository at this point in the history
Symfony compatibility: remove wrongly overridden "load()" method but preserve the logic
  • Loading branch information
jonnnnyw committed Apr 3, 2018
2 parents b3c3e20 + 0f56dd5 commit 9fa2959
Showing 1 changed file with 10 additions and 21 deletions.
31 changes: 10 additions & 21 deletions src/JonnyW/PhantomJs/DependencyInjection/ServiceContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ServiceContainer extends ContainerBuilder
/**
* Service container instance
*
* @var \JonnyW\PhantomJs\DependencyInjection\ServiceContainer
* @var static
* @access private
*/
private static $instance;
Expand All @@ -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');
}
}

0 comments on commit 9fa2959

Please sign in to comment.