diff options
author | diosmosis <benaka@piwik.pro> | 2015-04-05 00:14:34 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-04-05 00:14:34 +0300 |
commit | 0c007ab7c5cf3b773c4e74f9c45ef0783a963997 (patch) | |
tree | 96fdd7bb44df0017120c828cbe4720e0a9a13a5c /core/Container | |
parent | 93127480a9ccaa091825b92e50395cdd2193618e (diff) |
Move DI container creation to Piwik\Application\Environment class.
Diffstat (limited to 'core/Container')
-rw-r--r-- | core/Container/StaticContainer.php | 33 |
1 files changed, 6 insertions, 27 deletions
diff --git a/core/Container/StaticContainer.php b/core/Container/StaticContainer.php index 8468dce2ae..b290d7d60b 100644 --- a/core/Container/StaticContainer.php +++ b/core/Container/StaticContainer.php @@ -25,13 +25,6 @@ class StaticContainer private static $container; /** - * Optional environment config to load. - * - * @var bool - */ - private static $environment; - - /** * Definitions to register in the container. * * @var array @@ -44,7 +37,7 @@ class StaticContainer public static function getContainer() { if (self::$container === null) { - self::$container = self::createContainer(); + throw new \Exception("The root container has not been created yet."); } return self::$container; @@ -65,25 +58,6 @@ class StaticContainer self::$container = $container; } - /** - * @link http://php-di.org/doc/container-configuration.html - */ - private static function createContainer() - { - $containerFactory = new ContainerFactory(self::$environment, self::$definitions); - return $containerFactory->create(); - } - - /** - * Set the application environment (cli, test, …) or null for the default one. - * - * @param string|null $environment - */ - public static function setEnvironment($environment) - { - self::$environment = $environment; - } - public static function addDefinitions(array $definitions) { self::$definitions = $definitions; @@ -100,4 +74,9 @@ class StaticContainer { return self::getContainer()->get($name); } + + public static function getDefinitons() + { + return self::$definitions; + } } |