diff options
author | diosmosis <benaka@piwik.pro> | 2015-05-21 06:00:11 +0300 |
---|---|---|
committer | diosmosis <benaka@piwik.pro> | 2015-05-25 01:22:14 +0300 |
commit | 38a51b00d3618fe512da3d7e4ba2ef401999c12a (patch) | |
tree | a2ec1cd2008fcb0977f03acc6c961d553457c88a /core/Config.php | |
parent | 0afc478224999dd58d8a9ca18ac59a4a88e68e52 (diff) |
Moved Config object to the DI container and override w/ TestConfig through DI config. Replaced the singleton GlobalSettingsProvider hack w/ the concept of an EnvironmentManipulator (internal to Piwik, not to be used anywhere but TestingEnvironment.php).
Diffstat (limited to 'core/Config.php')
-rw-r--r-- | core/Config.php | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/core/Config.php b/core/Config.php index 0d25eb19ac..e04909b942 100644 --- a/core/Config.php +++ b/core/Config.php @@ -11,6 +11,7 @@ namespace Piwik; use Exception; use Piwik\Application\Kernel\GlobalSettingsProvider; +use Piwik\Container\StaticContainer; /** * Singleton that provides read & write access to Piwik's INI configuration. @@ -36,8 +37,6 @@ use Piwik\Application\Kernel\GlobalSettingsProvider; * * Config::getInstance()->MySection = array('myoption' => 1); * Config::getInstance()->forceSave(); - * - * @method static Config getInstance() */ class Config extends Singleton { @@ -55,9 +54,17 @@ class Config extends Singleton */ protected $settings; - public function __construct($pathGlobal = null, $pathLocal = null, $pathCommon = null) + /** + * @return Config + */ + public static function getInstance() + { + return StaticContainer::get('Piwik\Config'); + } + + public function __construct(GlobalSettingsProvider $settings) { - $this->settings = GlobalSettingsProvider::getSingletonInstance($pathGlobal, $pathLocal, $pathCommon); + $this->settings = $settings; } /** |