diff --git a/composer.lock b/composer.lock index 3f75b721826..fdddc728f8c 100644 --- a/composer.lock +++ b/composer.lock @@ -269,12 +269,12 @@ "source": { "type": "git", "url": "https://github.com/mnapoli/PHP-DI.git", - "reference": "27341c05b930e3768f19f4c4b20eec14ce84bd06" + "reference": "d7f54f3c1b3523493eb5f4b5ca38bcfd74d96169" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/mnapoli/PHP-DI/zipball/27341c05b930e3768f19f4c4b20eec14ce84bd06", - "reference": "27341c05b930e3768f19f4c4b20eec14ce84bd06", + "url": "https://api.github.com/repos/mnapoli/PHP-DI/zipball/d7f54f3c1b3523493eb5f4b5ca38bcfd74d96169", + "reference": "d7f54f3c1b3523493eb5f4b5ca38bcfd74d96169", "shasum": "" }, "require": { @@ -299,10 +299,8 @@ } }, "autoload": { - "psr-0": { - "DI\\": "src/", - "IntegrationTests\\": "tests/", - "UnitTests\\": "tests/" + "psr-4": { + "DI\\": "src/DI/" }, "files": [ "src/DI/functions.php" @@ -319,7 +317,7 @@ "dependency injection", "di" ], - "time": "2014-11-12 03:18:24" + "time": "2014-12-11 22:24:18" }, { "name": "mnapoli/phpdocreader", diff --git a/core/Container/IniConfigDefinitionSource.php b/core/Container/IniConfigDefinitionSource.php index b84d33d94f6..5d4518196bd 100644 --- a/core/Container/IniConfigDefinitionSource.php +++ b/core/Container/IniConfigDefinitionSource.php @@ -9,16 +9,14 @@ namespace Piwik\Container; use DI\Definition\Exception\DefinitionException; -use DI\Definition\MergeableDefinition; use DI\Definition\Source\ChainableDefinitionSource; -use DI\Definition\Source\DefinitionSource; use DI\Definition\ValueDefinition; use Piwik\Config; /** * Import the old INI config into PHP-DI. */ -class IniConfigDefinitionSource implements DefinitionSource, ChainableDefinitionSource +class IniConfigDefinitionSource extends ChainableDefinitionSource { /** * @var Config @@ -30,11 +28,6 @@ class IniConfigDefinitionSource implements DefinitionSource, ChainableDefinition */ private $prefix; - /** - * @var DefinitionSource - */ - private $chainedSource; - /** * @param Config $config * @param string $prefix Prefix for the container entries. @@ -45,15 +38,10 @@ public function __construct(Config $config, $prefix = 'old_config.') $this->prefix = $prefix; } - public function getDefinition($name, MergeableDefinition $parentDefinition = null) + protected function findDefinition($name) { - // INI only contains values, so no definition merging here - if ($parentDefinition) { - return $this->notFound($name, $parentDefinition); - } - if (strpos($name, $this->prefix) !== 0) { - return $this->notFound($name, $parentDefinition); + return null; } list($sectionName, $configKey) = $this->parseEntryName($name); @@ -65,17 +53,12 @@ public function getDefinition($name, MergeableDefinition $parentDefinition = nul } if (! array_key_exists($configKey, $section)) { - return $this->notFound($name, $parentDefinition); + return null; } return new ValueDefinition($name, $section[$configKey]); } - public function chain(DefinitionSource $source) - { - $this->chainedSource = $source; - } - private function parseEntryName($name) { $parts = explode('.', $name, 3); @@ -102,13 +85,4 @@ private function getSection($sectionName) return $section; } - - private function notFound($name, $parentDefinition) - { - if ($this->chainedSource) { - return $this->chainedSource->getDefinition($name, $parentDefinition); - } - - return null; - } }