From 6debb1eabd0096f567c05216d3683d34805e3ee1 Mon Sep 17 00:00:00 2001 From: overclokk Date: Mon, 25 Nov 2019 07:39:03 +0100 Subject: [PATCH] Fixed license issue --- README.md | 11 +++++++++-- composer.json | 3 ++- index.php | 5 ++--- tests/unit/ConfigTest.php | 25 +++++++++++++++---------- 4 files changed, 28 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 7cbc2aa..f5ff581 100644 --- a/README.md +++ b/README.md @@ -27,11 +27,18 @@ composer require italystrap/config ## Basic Usage -> TODO +```php +use ItalyStrap\Config\Config; + +$config = new Config( $configObjOrArrayOptional, $configDefaultOptional ); + +$value = $config->get( 'key', $optionalDefaultValue ); + +``` ## Advanced Usage -> TODO +You can see more advanced example in the tests folder. ## Contributing diff --git a/composer.json b/composer.json index 052d382..7c62ef0 100644 --- a/composer.json +++ b/composer.json @@ -22,6 +22,7 @@ "lucatume/wp-browser": "~2.0", "brightnucleus/config": "*", "wpfulcrum/config": "*", - "italystrap/debug": "^2.0" + "italystrap/debug": "^2.0", + "phpunit/php-code-coverage": "^7.0" } } diff --git a/index.php b/index.php index f66d3c2..61d1107 100644 --- a/index.php +++ b/index.php @@ -33,8 +33,7 @@ require( __DIR__ . '/vendor/autoload.php' ); -use \ItalyStrap\Config\Config; -use \ItalyStrap\Config\Config_Factory; +use ItalyStrap\Config\{Config, ConfigFactory}; // $config = Config_Factory::make( [ 'test' => 'value' ], [ 'test' => null ] ); // @@ -42,7 +41,7 @@ // ddd( $config->test ); add_action( 'wp_footer', function () { - $config = Config_Factory::make( [ 'test' => 'value', 'test2' => 'value2' ], [ 'test' => null ] ); + $config = ConfigFactory::make( [ 'test' => 'value', 'test2' => 'value2' ], [ 'test' => null ] ); // d( $config->all() ); // diff --git a/tests/unit/ConfigTest.php b/tests/unit/ConfigTest.php index e1f29cb..5096bc3 100644 --- a/tests/unit/ConfigTest.php +++ b/tests/unit/ConfigTest.php @@ -49,24 +49,29 @@ public function testFileExists() public function it_should_be_instantiatable() { $config = new Config(); - $this->assertInstanceOf( '\ItalyStrap\Config\Config', $config ); - $this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config ); $config = new Config( [] ); - $this->assertInstanceOf( '\ItalyStrap\Config\Config', $config ); - $this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config ); $config = new Config( [], [] ); - $this->assertInstanceOf( '\ItalyStrap\Config\Config', $config ); - $this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config ); $config = new Config( $this->config_arr ); - $this->assertInstanceOf( '\ItalyStrap\Config\Config', $config ); - $this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config ); $config = new Config( $this->config_arr, $this->default_arr ); - $this->assertInstanceOf( '\ItalyStrap\Config\Config', $config ); - $this->assertInstanceOf( '\ItalyStrap\Config\Config_Interface', $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\Config_Interface::class, $config ); + $this->assertInstanceOf( ItalyStrap\Config\ConfigInterface::class, $config ); } /**