Skip to content

Instantly share code, notes, and snippets.

@kanian
Last active March 21, 2019 12:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kanian/8e0c599d12a9cfde0b5cd5e75f7c7cdc to your computer and use it in GitHub Desktop.
Save kanian/8e0c599d12a9cfde0b5cd5e75f7c7cdc to your computer and use it in GitHub Desktop.
ContainerSingletonize
<?php
namespace Kanian\ContainerX;
use Assoa\PatternFactories\SingletonFactory;
//..
class Container implements ContainerInterface
{
//..
public function singletonize($dependencyKey, $className)
{
$singletonClass = SingletonFactory::get($className);
$this->set($dependencyKey, $singletonClass);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment