diff --git a/.travis.yml b/.travis.yml index 6fe035c..7034573 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,23 @@ -install: - - composer install language: php -php: - - '5.4' - - '5.5' - - '5.6' - - '7.0' - - hhvm - - nightly + +matrix: + include: + - php: 5.4 + dist: trusty + - php: 5.5 + dist: trusty + - php: 5.6 + dist: trusty + - php: 7.0 + dist: trusty + - php: 7.1 + dist: bionic + - php: 7.2 + dist: bionic + - php: 7.3 + dist: bionic + - php: 7.4 + dist: bionic + +install: travis_retry composer install +script: ./vendor/bin/phpunit diff --git a/README.md b/README.md index b994e7e..4b5e41c 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![Build Status](https://travis-ci.org/Shudrum/ArrayFinder.svg?branch=master)](https://travis-ci.org/Shudrum/ArrayFinder) -#ArrayFinder Component +# ArrayFinder Component The ArrayFinder component allow you to manage large nested arrays with ease. @@ -28,11 +28,11 @@ To install this package, you can simply use composer: composer require shudrum/array-finder ``` -##Documentation +## Documentation -###Methods +### Methods -####get($path) +#### get($path) You can get a value following a path separated by a '.'. @@ -56,7 +56,7 @@ $myValue = $arrayFinder->get(0); // value3 If the path is `null`, all the content will be returned. -####set($path, $value) +#### set($path, $value) You can add a value to a specific path separated by a '.'. If the nested arrays does not exists, it will be created. @@ -69,7 +69,7 @@ $arrayFinder->set('a.b', 'value'); $arrayFinder->get(); // ['a' => ['b' => 'value]] ``` -####changeSeparator($separator) +#### changeSeparator($separator) If the default separator (.) does not fit to your needs, you can call this method to change it. @@ -82,11 +82,11 @@ $myValue = $arrayFinder->changeSeparator('/'); $myValue = $arrayFinder->get('a/b/c'); ``` -###Implementations +### Implementations The ArrayFinder component implements some usefull interfaces: -####ArrayAccess +#### ArrayAccess You can use this object like an array: @@ -100,7 +100,7 @@ $arrayFinder['a.b.c'] = 'value'; unset($arrayFinder['a.b']); ``` -####Countable +#### Countable You can use count on this object: @@ -113,7 +113,7 @@ count($arrayFinder); count($arrayFinder['a.b']); ``` -####Iterator +#### Iterator You can iterate on this object: @@ -127,7 +127,7 @@ foreach ($arrayFinder as $key => $value) { } ``` -####Serializable +#### Serializable You can easily serialize / unserialize this object. diff --git a/Tests/ArrayFinderTest.php b/Tests/ArrayFinderTest.php index db38cbb..7096455 100644 --- a/Tests/ArrayFinderTest.php +++ b/Tests/ArrayFinderTest.php @@ -2,9 +2,17 @@ namespace Shudrum\Component\ArrayFinder\Tests; +// PHPUnit backward compatibility +if ( + !class_exists('\PHPUnit\Framework\TestCase') + && class_exists('\PHPUnit_Framework_TestCase') +) { + class_alias('\PHPUnit_Framework_TestCase', '\PHPUnit\Framework\TestCase'); +} + use Shudrum\Component\ArrayFinder\ArrayFinder; -class ArrayFinderTest extends \PHPUnit_Framework_TestCase +class ArrayFinderTest extends \PHPUnit\Framework\TestCase { /** @var ArrayFinder */ private $arrayFinder; diff --git a/composer.json b/composer.json index ec6ac78..ebbe2f5 100644 --- a/composer.json +++ b/composer.json @@ -19,5 +19,8 @@ "exclude-from-classmap": [ "/Tests/" ] + }, + "require-dev": { + "phpunit/phpunit": "^4.8 || ^7.5" } }