Skip to content

Commit

Permalink
Improved Config loader naming.
Browse files Browse the repository at this point in the history
  • Loading branch information
nikolaposa committed Feb 26, 2017
1 parent bf3fa96 commit 60ef51d
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 14 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ Component that connects these different pieces together is `Bootstrap` which is

```php
use Phoundation\Bootstrap\Bootstrap;
use Phoundation\Config\Loader\FileLoader;
use Phoundation\Config\Loader\FileConfigLoader;
use Phoundation\Di\Container\Factory\ZendServiceManagerFactory;

$bootstrap = new Bootstrap(
new FileLoader(glob(sprintf('config/{{,*.}global,{,*.}%s}.php', getenv('APP_ENV') ?: 'local'), GLOB_BRACE)),
new FileConfigLoader(glob(sprintf('config/{{,*.}global,{,*.}%s}.php', getenv('APP_ENV') ?: 'local'), GLOB_BRACE)),
new ZendServiceManagerFactory()
);
$diContainer = $bootstrap();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,15 @@

namespace Phoundation\Config\Loader;

use Phoundation\Config\Config;

/**
* @author Nikola Posa <[email protected]>
*/
class CachingLoader
final class CachingConfigLoader implements ConfigLoaderInterface
{
public function __invoke() : Config
{
// TODO: Implement __invoke() method.
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* @author Nikola Posa <[email protected]>
*/
final class FileLoader extends AbstractLoader
final class FileConfigLoader extends AbstractLoader
{
/**
* @var array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
/**
* @author Nikola Posa <[email protected]>
*/
final class StaticLoader implements ConfigLoaderInterface
final class StaticConfigLoader implements ConfigLoaderInterface
{
/**
* @var array
Expand Down
10 changes: 5 additions & 5 deletions tests/Bootstrap/BootstrapTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

use PHPUnit\Framework\TestCase;
use Phoundation\Bootstrap\Bootstrap;
use Phoundation\Config\Loader\StaticLoader;
use Phoundation\Config\Loader\StaticConfigLoader;
use Interop\Container\ContainerInterface;
use Phoundation\Config\Config;
use Phoundation\Di\Container\Factory\DiContainerFactoryInterface;
Expand All @@ -35,7 +35,7 @@ class BootstrapTest extends TestCase
public function it_produces_di_container()
{
$bootstrap = new Bootstrap(
new StaticLoader([
new StaticConfigLoader([
'foo' => 'bar',
]),
new ZendServiceManagerFactory()
Expand All @@ -53,7 +53,7 @@ public function it_produces_di_container()
public function it_puts_config_into_di_container()
{
$bootstrap = new Bootstrap(
new StaticLoader([
new StaticConfigLoader([
'foo' => 'bar',
]),
new ZendServiceManagerFactory()
Expand All @@ -74,7 +74,7 @@ public function it_sets_php_settings_if_provided_through_config()
$currentTz = ini_get('date.timezone');

$bootstrap = new Bootstrap(
new StaticLoader([
new StaticConfigLoader([
'php_settings' => [
'date.timezone' => 'Europe/Belgrade',
],
Expand All @@ -95,7 +95,7 @@ public function it_sets_php_settings_if_provided_through_config()
public function it_registers_error_handler_if_provided_through_di_config()
{
$bootstrap = new Bootstrap(
new StaticLoader([
new StaticConfigLoader([
'di' => [
'factories' => [
RunnerInterface::class => function () {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,20 @@
namespace Phoundation\Tests\Config;

use PHPUnit\Framework\TestCase;
use Phoundation\Config\Loader\FileLoader;
use Phoundation\Config\Loader\FileConfigLoader;
use Phoundation\Config\Config;

/**
* @author Nikola Posa <[email protected]>
*/
class FileLoaderTest extends TestCase
class FileConfigLoaderTest extends TestCase
{
/**
* @test
*/
public function it_loads_config_from_path()
{
$loader = new FileLoader([
$loader = new FileConfigLoader([
__DIR__ . '/../../TestAsset/Config/global.php',
]);

Expand All @@ -41,7 +41,7 @@ public function it_loads_config_from_path()
*/
public function it_loads_config_from_glob_path()
{
$loader = new FileLoader(glob(__DIR__ . '/../../TestAsset/Config/{{,*.}global,{,*.}local}.php', GLOB_BRACE));
$loader = new FileConfigLoader(glob(__DIR__ . '/../../TestAsset/Config/{{,*.}global,{,*.}local}.php', GLOB_BRACE));

$config = $loader();

Expand Down

0 comments on commit 60ef51d

Please sign in to comment.