Last active
March 21, 2019 12:56
-
-
Save kanian/8e0c599d12a9cfde0b5cd5e75f7c7cdc to your computer and use it in GitHub Desktop.
ContainerSingletonize
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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