diff --git a/composer.json b/composer.json index a20436a..c7716e4 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,7 @@ { "name": "igorw/config-service-provider", - "description": "A config ServiceProvider for Silex with support for php, json and yaml.", - "keywords": ["silex"], + "description": "A config ServiceProvider for Pimple with support for php, json and yaml.", + "keywords": ["silex", "pimple"], "license": "MIT", "authors": [ { @@ -14,7 +14,7 @@ } ], "require": { - "silex/silex": "~1.0" + "pimple/pimple": "~3.0" }, "require-dev": { "symfony/yaml": "~2.1", @@ -25,11 +25,11 @@ "jamesmoss/toml": "~0.1" }, "autoload": { - "psr-0": { "Igorw\\Silex": "src" } + "psr-4": { "Igorw\\Silex\\": "src/Igorw/Silex/" } }, "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "2.0-dev" } } } diff --git a/src/Igorw/Silex/ConfigServiceProvider.php b/src/Igorw/Silex/ConfigServiceProvider.php index ee70599..e77ca70 100644 --- a/src/Igorw/Silex/ConfigServiceProvider.php +++ b/src/Igorw/Silex/ConfigServiceProvider.php @@ -11,8 +11,8 @@ namespace Igorw\Silex; -use Silex\Application; -use Silex\ServiceProviderInterface; +use Pimple\Container; +use Pimple\ServiceProviderInterface; class ConfigServiceProvider implements ServiceProviderInterface { @@ -40,7 +40,7 @@ public function __construct($filename, array $replacements = array(), ConfigDriv )); } - public function register(Application $app) + public function register(Container $app) { $config = $this->readConfig(); @@ -51,11 +51,11 @@ public function register(Application $app) $this->merge($app, $config); } - public function boot(Application $app) + public function boot(Container $app) { } - private function merge(Application $app, array $config) + private function merge(Container $app, array $config) { if ($this->prefix) { $config = array($this->prefix => $config); diff --git a/tests/integration/ConfigServiceProviderTest.php b/tests/integration/ConfigServiceProviderTest.php index 168b721..f98bfdc 100644 --- a/tests/integration/ConfigServiceProviderTest.php +++ b/tests/integration/ConfigServiceProviderTest.php @@ -9,7 +9,7 @@ * file that was distributed with this source code. */ -use Silex\Application; +use Pimple\Container; use Igorw\Silex\ConfigServiceProvider; /** @@ -23,7 +23,7 @@ class ConfigServiceProviderTest extends \PHPUnit_Framework_TestCase */ public function testRegisterWithoutReplacement($filename) { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider($filename)); @@ -36,7 +36,7 @@ public function testRegisterWithoutReplacement($filename) */ public function testRegisterWithReplacement($filename) { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider($filename, array( 'data' => 'test-replacement' @@ -65,7 +65,7 @@ public function testEmptyConfigs($filename) */ public function testInFileReplacements($filename) { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider($filename)); @@ -81,7 +81,7 @@ public function testInFileReplacements($filename) */ public function testTomlMergeConfigs() { - $app = new Application(); + $app = new Container(); $filenameBase = __DIR__."/Fixtures/config_base.toml"; $filenameExtended = __DIR__."/Fixtures/config_extend.toml"; @@ -110,7 +110,7 @@ public function testTomlMergeConfigs() */ public function testConfigWithPrefix($filename) { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider($filename, array(), null, 'prefix')); $this->assertNotNull($app['prefix']); $this->assertSame(true, $app['prefix']['debug']); @@ -122,7 +122,7 @@ public function testConfigWithPrefix($filename) */ public function testMergeConfigsWithPrefix($filenameBase, $filenameExtended) { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider($filenameBase, array(), null, 'prefix')); $app->register(new ConfigServiceProvider($filenameExtended, array(), null, 'prefix')); @@ -143,7 +143,7 @@ public function testMergeConfigsWithPrefix($filenameBase, $filenameExtended) */ public function testConfigsWithMultiplePrefixes($filenameBase, $filenameExtended) { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider($filenameBase, array(), null, 'base')); $app->register(new ConfigServiceProvider($filenameExtended, array(), null, 'extended')); @@ -160,7 +160,7 @@ public function testConfigsWithMultiplePrefixes($filenameBase, $filenameExtended */ public function testMergeConfigs($filenameBase, $filenameExtended) { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider($filenameBase)); $app->register(new ConfigServiceProvider($filenameExtended)); @@ -189,7 +189,7 @@ public function testMergeConfigs($filenameBase, $filenameExtended) */ public function invalidJsonShouldThrowException() { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider(__DIR__."/Fixtures/broken.json")); } @@ -199,7 +199,7 @@ public function invalidJsonShouldThrowException() */ public function invalidYamlShouldThrowException() { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider(__DIR__."/Fixtures/broken.yml")); } @@ -209,7 +209,7 @@ public function invalidYamlShouldThrowException() */ public function invalidTomlShouldThrowException() { - $app = new Application(); + $app = new Container(); $app->register(new ConfigServiceProvider(__DIR__."/Fixtures/broken.toml")); }