diff --git a/composer.lock b/composer.lock index 0c5da89..f7b78c1 100644 --- a/composer.lock +++ b/composer.lock @@ -4,22 +4,22 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "469f493b2d8087d770a8b5541ebb5723", - "content-hash": "bd9b45abd52efc234a35faf70b22e402", + "hash": "3d9826b6919922aedfde5b3604d0e8d3", + "content-hash": "932b9b3201b67afa047a8c0bdc456895", "packages": [], "packages-dev": [ { "name": "doctrine/instantiator", - "version": "dev-master", + "version": "1.0.5", "source": { "type": "git", "url": "https://github.com/doctrine/instantiator.git", - "reference": "416fb8ad1d095a87f1d21bc40711843cd122fd4a" + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/doctrine/instantiator/zipball/416fb8ad1d095a87f1d21bc40711843cd122fd4a", - "reference": "416fb8ad1d095a87f1d21bc40711843cd122fd4a", + "url": "https://api.github.com/repos/doctrine/instantiator/zipball/8e884e78f9f0eb1329e445619e04456e64d8051d", + "reference": "8e884e78f9f0eb1329e445619e04456e64d8051d", "shasum": "" }, "require": { @@ -60,20 +60,20 @@ "constructor", "instantiate" ], - "time": "2016-03-31 10:24:22" + "time": "2015-06-14 21:17:01" }, { "name": "myclabs/deep-copy", - "version": "1.5.1", + "version": "1.5.4", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "a8773992b362b58498eed24bf85005f363c34771" + "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/a8773992b362b58498eed24bf85005f363c34771", - "reference": "a8773992b362b58498eed24bf85005f363c34771", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/ea74994a3dc7f8d2f65a06009348f2d63c81e61f", + "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f", "shasum": "" }, "require": { @@ -102,11 +102,11 @@ "object", "object graph" ], - "time": "2015-11-20 12:04:31" + "time": "2016-09-16 13:37:59" }, { "name": "phpdocumentor/reflection-common", - "version": "dev-master", + "version": "1.0", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionCommon.git", @@ -160,16 +160,16 @@ }, { "name": "phpdocumentor/reflection-docblock", - "version": "3.1.0", + "version": "3.1.1", "source": { "type": "git", "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd" + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/9270140b940ff02e58ec577c237274e92cd40cdd", - "reference": "9270140b940ff02e58ec577c237274e92cd40cdd", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/8331b5efe816ae05461b7ca1e721c01b46bafb3e", + "reference": "8331b5efe816ae05461b7ca1e721c01b46bafb3e", "shasum": "" }, "require": { @@ -201,7 +201,7 @@ } ], "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", - "time": "2016-06-10 09:48:41" + "time": "2016-09-30 07:12:33" }, { "name": "phpdocumentor/type-resolver", @@ -252,16 +252,16 @@ }, { "name": "phpspec/prophecy", - "version": "dev-master", + "version": "v1.6.1", "source": { "type": "git", "url": "https://github.com/phpspec/prophecy.git", - "reference": "d883566b83ae601a50b38b249e92450dc57cf875" + "reference": "58a8137754bc24b25740d4281399a4a3596058e0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpspec/prophecy/zipball/d883566b83ae601a50b38b249e92450dc57cf875", - "reference": "d883566b83ae601a50b38b249e92450dc57cf875", + "url": "https://api.github.com/repos/phpspec/prophecy/zipball/58a8137754bc24b25740d4281399a4a3596058e0", + "reference": "58a8137754bc24b25740d4281399a4a3596058e0", "shasum": "" }, "require": { @@ -310,20 +310,20 @@ "spy", "stub" ], - "time": "2016-07-19 16:08:43" + "time": "2016-06-07 08:13:47" }, { "name": "phpunit/php-code-coverage", - "version": "dev-master", + "version": "4.0.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "bb1c920291e2db3d3e50b77aded8bbfc351d3ff5" + "reference": "5f3f7e736d6319d5f1fc402aff8b026da26709a3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/bb1c920291e2db3d3e50b77aded8bbfc351d3ff5", - "reference": "bb1c920291e2db3d3e50b77aded8bbfc351d3ff5", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5f3f7e736d6319d5f1fc402aff8b026da26709a3", + "reference": "5f3f7e736d6319d5f1fc402aff8b026da26709a3", "shasum": "" }, "require": { @@ -373,11 +373,11 @@ "testing", "xunit" ], - "time": "2016-08-19 13:51:08" + "time": "2016-07-26 14:39:29" }, { "name": "phpunit/php-file-iterator", - "version": "dev-master", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-file-iterator.git", @@ -509,16 +509,16 @@ }, { "name": "phpunit/php-token-stream", - "version": "dev-master", + "version": "1.4.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-token-stream.git", - "reference": "cab6c6fefee93d7b7c3a01292a0fe0884ea66644" + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/cab6c6fefee93d7b7c3a01292a0fe0884ea66644", - "reference": "cab6c6fefee93d7b7c3a01292a0fe0884ea66644", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", + "reference": "3144ae21711fb6cac0b1ab4cbe63b75ce3d4e8da", "shasum": "" }, "require": { @@ -554,28 +554,28 @@ "keywords": [ "tokenizer" ], - "time": "2015-09-23 14:46:55" + "time": "2015-09-15 10:49:45" }, { "name": "phpunit/phpunit", - "version": "5.7.x-dev", + "version": "5.5.6", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "6346531bfd3dc1bb3ecb9d2f53bade04c6ba0e14" + "reference": "146e0fe0bb7f44d1cefade0c93e86fe0b206dd79" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/6346531bfd3dc1bb3ecb9d2f53bade04c6ba0e14", - "reference": "6346531bfd3dc1bb3ecb9d2f53bade04c6ba0e14", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/146e0fe0bb7f44d1cefade0c93e86fe0b206dd79", + "reference": "146e0fe0bb7f44d1cefade0c93e86fe0b206dd79", "shasum": "" }, "require": { "ext-dom": "*", "ext-json": "*", - "ext-pcre": "*", - "ext-reflection": "*", - "ext-spl": "*", + "ext-libxml": "*", + "ext-mbstring": "*", + "ext-xml": "*", "myclabs/deep-copy": "~1.3", "php": "^5.6 || ^7.0", "phpspec/prophecy": "^1.3.1", @@ -597,7 +597,12 @@ "conflict": { "phpdocumentor/reflection-docblock": "3.0.2" }, + "require-dev": { + "ext-pdo": "*" + }, "suggest": { + "ext-tidy": "*", + "ext-xdebug": "*", "phpunit/php-invoker": "~1.1" }, "bin": [ @@ -606,7 +611,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "5.7.x-dev" + "dev-master": "5.5.x-dev" } }, "autoload": { @@ -632,20 +637,20 @@ "testing", "xunit" ], - "time": "2016-08-20 09:56:59" + "time": "2016-10-03 07:48:45" }, { "name": "phpunit/phpunit-mock-objects", - "version": "dev-master", + "version": "3.3.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", - "reference": "46b249b43fd2ed8e127aa0fdb3cbcf56e9bc0e49" + "reference": "7462c19bdb9814f6e6bdeb5cad3eb3ce72c6e0da" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/46b249b43fd2ed8e127aa0fdb3cbcf56e9bc0e49", - "reference": "46b249b43fd2ed8e127aa0fdb3cbcf56e9bc0e49", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/7462c19bdb9814f6e6bdeb5cad3eb3ce72c6e0da", + "reference": "7462c19bdb9814f6e6bdeb5cad3eb3ce72c6e0da", "shasum": "" }, "require": { @@ -691,11 +696,11 @@ "mock", "xunit" ], - "time": "2016-08-26 05:51:59" + "time": "2016-09-27 03:17:40" }, { "name": "sebastian/code-unit-reverse-lookup", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git", @@ -740,7 +745,7 @@ }, { "name": "sebastian/comparator", - "version": "dev-master", + "version": "1.2.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/comparator.git", @@ -804,7 +809,7 @@ }, { "name": "sebastian/diff", - "version": "dev-master", + "version": "1.4.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", @@ -856,28 +861,28 @@ }, { "name": "sebastian/environment", - "version": "dev-master", + "version": "1.3.8", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/environment.git", - "reference": "b429478521ee551c5622fec271a2b3bf99de1619" + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/b429478521ee551c5622fec271a2b3bf99de1619", - "reference": "b429478521ee551c5622fec271a2b3bf99de1619", + "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/be2c607e43ce4c89ecd60e75c6a85c126e754aea", + "reference": "be2c607e43ce4c89ecd60e75c6a85c126e754aea", "shasum": "" }, "require": { - "php": "^5.6 || ^7.0" + "php": "^5.3.3 || ^7.0" }, "require-dev": { - "phpunit/phpunit": "^5.0" + "phpunit/phpunit": "^4.8 || ^5.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "2.0.x-dev" + "dev-master": "1.3.x-dev" } }, "autoload": { @@ -902,11 +907,11 @@ "environment", "hhvm" ], - "time": "2016-08-18 05:48:30" + "time": "2016-08-18 05:49:44" }, { "name": "sebastian/exporter", - "version": "dev-master", + "version": "1.2.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/exporter.git", @@ -1024,16 +1029,16 @@ }, { "name": "sebastian/object-enumerator", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/object-enumerator.git", - "reference": "d1e9bfd178891acc7a1d650e30b0645423af011d" + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d1e9bfd178891acc7a1d650e30b0645423af011d", - "reference": "d1e9bfd178891acc7a1d650e30b0645423af011d", + "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/d4ca2fb70344987502567bc50081c03e6192fb26", + "reference": "d4ca2fb70344987502567bc50081c03e6192fb26", "shasum": "" }, "require": { @@ -1066,20 +1071,20 @@ ], "description": "Traverses array structures and object graphs to enumerate all referenced objects", "homepage": "https://github.com/sebastianbergmann/object-enumerator/", - "time": "2016-07-29 07:38:17" + "time": "2016-01-28 13:25:10" }, { "name": "sebastian/recursion-context", - "version": "dev-master", + "version": "1.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/recursion-context.git", - "reference": "7ff5b1b3dcc55b8ab8ae61ef99d4730940856ee7" + "reference": "913401df809e99e4f47b27cdd781f4a258d58791" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/7ff5b1b3dcc55b8ab8ae61ef99d4730940856ee7", - "reference": "7ff5b1b3dcc55b8ab8ae61ef99d4730940856ee7", + "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/913401df809e99e4f47b27cdd781f4a258d58791", + "reference": "913401df809e99e4f47b27cdd781f4a258d58791", "shasum": "" }, "require": { @@ -1119,11 +1124,11 @@ ], "description": "Provides functionality to recursively process PHP variables", "homepage": "http://www.github.com/sebastianbergmann/recursion-context", - "time": "2016-01-28 05:39:29" + "time": "2015-11-11 19:50:13" }, { "name": "sebastian/resource-operations", - "version": "dev-master", + "version": "1.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/resource-operations.git", @@ -1165,7 +1170,7 @@ }, { "name": "sebastian/version", - "version": "dev-master", + "version": "2.0.0", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/version.git", @@ -1208,31 +1213,25 @@ }, { "name": "symfony/yaml", - "version": "dev-master", + "version": "v3.1.4", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "aa8be2235b5dd4e472424552390609f61996f5ab" + "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/aa8be2235b5dd4e472424552390609f61996f5ab", - "reference": "aa8be2235b5dd4e472424552390609f61996f5ab", + "url": "https://api.github.com/repos/symfony/yaml/zipball/f291ed25eb1435bddbe8a96caaef16469c2a092d", + "reference": "f291ed25eb1435bddbe8a96caaef16469c2a092d", "shasum": "" }, "require": { "php": ">=5.5.9" }, - "require-dev": { - "symfony/console": "~2.8|~3.0" - }, - "suggest": { - "symfony/console": "For validating YAML files using the lint command" - }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.2-dev" + "dev-master": "3.1-dev" } }, "autoload": { @@ -1259,24 +1258,24 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-09-02 02:14:06" + "time": "2016-09-02 02:12:52" }, { "name": "webmozart/assert", - "version": "dev-master", + "version": "1.1.0", "source": { "type": "git", "url": "https://github.com/webmozart/assert.git", - "reference": "8444f2ac9f86342665cdae47b6d3ea6e07794456" + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozart/assert/zipball/8444f2ac9f86342665cdae47b6d3ea6e07794456", - "reference": "8444f2ac9f86342665cdae47b6d3ea6e07794456", + "url": "https://api.github.com/repos/webmozart/assert/zipball/bb2d123231c095735130cc8f6d31385a44c7b308", + "reference": "bb2d123231c095735130cc8f6d31385a44c7b308", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0" + "php": "^5.3.3|^7.0" }, "require-dev": { "phpunit/phpunit": "^4.6", @@ -1309,11 +1308,11 @@ "check", "validate" ], - "time": "2016-08-18 09:30:53" + "time": "2016-08-09 15:02:57" } ], "aliases": [], - "minimum-stability": "dev", + "minimum-stability": "stable", "stability-flags": [], "prefer-stable": false, "prefer-lowest": false, diff --git a/src/Common/Util/Iteration.php b/src/Common/Util/Iteration.php index 338dff7..b1597d0 100644 --- a/src/Common/Util/Iteration.php +++ b/src/Common/Util/Iteration.php @@ -17,9 +17,10 @@ class Iteration { * @param string $name * @param object|array $source * @param mixed $defaultValue + * @param bool $traverse * @return mixed */ - public static function findValueByName(string $name, $source, $defaultValue = null) { + public static function findValueByName(string $name, $source, $defaultValue = null, bool $traverse = false) { if(!is_array($source) && !is_object($source)) { throw new \InvalidArgumentException('The source must be an array, or an object with accessible properties.'); } @@ -29,13 +30,12 @@ public static function findValueByName(string $name, $source, $defaultValue = nu $sourceValue = $value; break; } - if(is_array($value) || is_object($value)) { - $sourceValue = self::findValueByName($name, $value, $defaultValue); + if($traverse && (is_array($value) || is_object($value))) { + $sourceValue = self::findValueByName($name, $value, $defaultValue, true); if($sourceValue !== $defaultValue) { break; } } - } return $sourceValue; diff --git a/tests/Common/ModelReflection/ModelClassTest.php b/tests/Common/ModelReflection/ModelClassTest.php index 3dd073f..cb380f2 100644 --- a/tests/Common/ModelReflection/ModelClassTest.php +++ b/tests/Common/ModelReflection/ModelClassTest.php @@ -20,7 +20,7 @@ public function setUp() { $object = new stdClass(); $object->a = 1; - $model = new TestModel(); + $model = new \TestModel(); $model->noType = null; $model->boolTrue = true; $model->boolFalse = false; @@ -34,7 +34,7 @@ public function setUp() { $model->objectArray = [$object,$object,$object]; $model->object = $object; - $nestedModel = new NestedTestModel(); + $nestedModel = new \NestedTestModel(); $nestedModel->noType = null; $nestedModel->boolTrue = true; $nestedModel->boolFalse = false; @@ -83,7 +83,7 @@ public function testConstructFail($invalidModel) { } public function testInstantiate() { - $expected = new TestModel(); + $expected = new \TestModel(); $actual = ModelClass::instantiate('\TestModel'); $this->assertEquals($expected, $actual); } @@ -92,7 +92,7 @@ public function testInstantiate() { * @expectedException Exception */ public function testInstantiateFail() { - $expected = new TestModel(); + $expected = new \TestModel(); $actual = ModelClass::instantiate('Asd\TestModel'); } diff --git a/tests/Common/ModelReflection/ModelPropertyTest.php b/tests/Common/ModelReflection/ModelPropertyTest.php index a795b0e..aaaa7c1 100644 --- a/tests/Common/ModelReflection/ModelPropertyTest.php +++ b/tests/Common/ModelReflection/ModelPropertyTest.php @@ -21,7 +21,7 @@ public function setUp() { $object = new stdClass(); $object->a = 1; - $model = new TestModel(); + $model = new \TestModel(); $model->noType = null; $model->boolTrue = true; $model->boolFalse = false; @@ -38,7 +38,7 @@ public function setUp() { $model->alwaysRequiredBoolean = false; $model->multipleRequiredInteger = 5; - $nestedModel = new NestedTestModel(); + $nestedModel = new \NestedTestModel(); $nestedModel->noType = null; $nestedModel->boolTrue = true; $nestedModel->boolFalse = false; @@ -161,7 +161,7 @@ public function validValues() { $object = new stdClass(); $object->a = 1; - $model = new TestModel(); + $model = new \TestModel(); $model->noType = null; $model->boolTrue = true; $model->boolFalse = false; @@ -178,7 +178,7 @@ public function validValues() { $model->alwaysRequiredBoolean = false; $model->multipleRequiredInteger = 5; - $nestedModel = new NestedTestModel(); + $nestedModel = new \NestedTestModel(); $nestedModel->noType = null; $nestedModel->boolTrue = true; $nestedModel->boolFalse = false; diff --git a/tests/Common/ModelReflection/ModelPropertyTypeTest.php b/tests/Common/ModelReflection/ModelPropertyTypeTest.php index 2aea5cd..e805e72 100644 --- a/tests/Common/ModelReflection/ModelPropertyTypeTest.php +++ b/tests/Common/ModelReflection/ModelPropertyTypeTest.php @@ -9,7 +9,6 @@ use Common\ModelReflection\ModelClass; use Common\ModelReflection\ModelProperty; -use Common\ModelReflection\ModelPropertyType; class ModelPropertyTypeTest extends PHPUnit_Framework_TestCase { @@ -22,7 +21,7 @@ public function setUp() { $object = new stdClass(); $object->a = 1; - $model = new TestModel(); + $model = new \TestModel(); $model->noType = null; $model->boolTrue = true; $model->boolFalse = false; @@ -39,7 +38,7 @@ public function setUp() { $model->alwaysRequiredBoolean = false; $model->multipleRequiredInteger = 5; - $nestedModel = new NestedTestModel(); + $nestedModel = new \NestedTestModel(); $nestedModel->noType = null; $nestedModel->boolTrue = true; $nestedModel->boolFalse = false;