Last active
August 29, 2015 14:20
-
-
Save Schlaefer/e2e25eb3eb8b1b1ae541 to your computer and use it in GitHub Desktop.
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 | |
class Dic { | |
/** | |
* @var \Aura\Di\Container; | |
*/ | |
static protected $_DIC; | |
public static function initialize() { | |
$dic = new \Aura\Di\Container(new \Aura\Di\Factory); | |
// do dependency setup: | |
$dic->params['ExampleNeedsService']['foo'] = $dic->lazyGet('foo_service'); | |
// … | |
self::$_DIC = $dic; | |
} | |
public static function set($key, $object) { | |
self::$_DIC->set($key, $object); | |
} | |
public static function get($key) { | |
return self::$_DIC->get($key); | |
} | |
public static function newInstance($key, array $params = [], array $setter = []) { | |
return self::$_DIC->newInstance($key, $params, $setter); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment