Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
@@ -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": [
{
Expand All @@ -14,7 +14,7 @@
}
],
"require": {
"silex/silex": "~1.0"
"pimple/pimple": "~3.0"
},
"require-dev": {
"symfony/yaml": "~2.1",
Expand All @@ -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"
}
}
}
10 changes: 5 additions & 5 deletions src/Igorw/Silex/ConfigServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

namespace Igorw\Silex;

use Silex\Application;
use Silex\ServiceProviderInterface;
use Pimple\Container;
use Pimple\ServiceProviderInterface;

class ConfigServiceProvider implements ServiceProviderInterface
{
Expand Down Expand Up @@ -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();

Expand All @@ -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);
Expand Down
24 changes: 12 additions & 12 deletions tests/integration/ConfigServiceProviderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* file that was distributed with this source code.
*/

use Silex\Application;
use Pimple\Container;
use Igorw\Silex\ConfigServiceProvider;

/**
Expand All @@ -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));

Expand All @@ -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'
Expand Down Expand Up @@ -65,7 +65,7 @@ public function testEmptyConfigs($filename)
*/
public function testInFileReplacements($filename)
{
$app = new Application();
$app = new Container();

$app->register(new ConfigServiceProvider($filename));

Expand All @@ -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";
Expand Down Expand Up @@ -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']);
Expand All @@ -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'));

Expand All @@ -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'));

Expand All @@ -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));

Expand Down Expand Up @@ -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"));
}

Expand All @@ -199,7 +199,7 @@ public function invalidJsonShouldThrowException()
*/
public function invalidYamlShouldThrowException()
{
$app = new Application();
$app = new Container();
$app->register(new ConfigServiceProvider(__DIR__."/Fixtures/broken.yml"));
}

Expand All @@ -209,7 +209,7 @@ public function invalidYamlShouldThrowException()
*/
public function invalidTomlShouldThrowException()
{
$app = new Application();
$app = new Container();
$app->register(new ConfigServiceProvider(__DIR__."/Fixtures/broken.toml"));
}

Expand Down