From 10976c1379e6ddd8976a2f41cefd7ff6212c74d1 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sun, 13 Nov 2016 18:54:32 +0100 Subject: [PATCH 1/2] Factory --- composer.json | 5 + composer.lock | 420 +++++++++++++++++++++++++++++++++++++++++++----- src/Factory.php | 63 ++++++++ 3 files changed, 448 insertions(+), 40 deletions(-) create mode 100644 src/Factory.php diff --git a/composer.json b/composer.json index 8c10af4..dbb283b 100644 --- a/composer.json +++ b/composer.json @@ -11,8 +11,13 @@ ], "require": { "php": "^7.0", + "container-interop/container-interop": "^1.1", + "igorw/get-in": "^1.0", + "joshdifabio/composed": "^1.0", "league/tactician": "^1.0", + "league/tactician-container": "^1.0", "react/event-loop": "^0.4.2", + "wyrihaximus/tactician-command-handler-mapper": "^1.0", "wyrihaximus/ticking-promise": "^1.6" }, "require-dev": { diff --git a/composer.lock b/composer.lock index 5f13d21..7d21aa7 100644 --- a/composer.lock +++ b/composer.lock @@ -4,9 +4,252 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "641191dfb6e5381c1ef613c8116c2095", - "content-hash": "66f5527ec43384979f736fdfccc2c1f4", + "hash": "862df4f0c3eb4fb05ea61eba80e6aaff", + "content-hash": "5e1dc8af5010e05d4a08b8850e7b9e8d", "packages": [ + { + "name": "container-interop/container-interop", + "version": "1.1.0", + "source": { + "type": "git", + "url": "https://github.com/container-interop/container-interop.git", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/container-interop/container-interop/zipball/fc08354828f8fd3245f77a66b9e23a6bca48297e", + "reference": "fc08354828f8fd3245f77a66b9e23a6bca48297e", + "shasum": "" + }, + "type": "library", + "autoload": { + "psr-4": { + "Interop\\Container\\": "src/Interop/Container/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Promoting the interoperability of container objects (DIC, SL, etc.)", + "time": "2014-12-30 15:22:37" + }, + { + "name": "doctrine/annotations", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/doctrine/annotations.git", + "reference": "30e07cf03edc3cd3ef579d0dd4dd8c58250799a5" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/annotations/zipball/30e07cf03edc3cd3ef579d0dd4dd8c58250799a5", + "reference": "30e07cf03edc3cd3ef579d0dd4dd8c58250799a5", + "shasum": "" + }, + "require": { + "doctrine/lexer": "1.*", + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "doctrine/cache": "1.*", + "phpunit/phpunit": "^5.6.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.4.x-dev" + } + }, + "autoload": { + "psr-4": { + "Doctrine\\Common\\Annotations\\": "lib/Doctrine/Common/Annotations" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Benjamin Eberlei", + "email": "kontakt@beberlei.de" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Jonathan Wage", + "email": "jonwage@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Docblock Annotations Parser", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "annotations", + "docblock", + "parser" + ], + "time": "2016-10-24 11:45:47" + }, + { + "name": "doctrine/lexer", + "version": "v1.0.1", + "source": { + "type": "git", + "url": "https://github.com/doctrine/lexer.git", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/lexer/zipball/83893c552fd2045dd78aef794c31e694c37c0b8c", + "reference": "83893c552fd2045dd78aef794c31e694c37c0b8c", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-0": { + "Doctrine\\Common\\Lexer\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Roman Borschel", + "email": "roman@code-factory.org" + }, + { + "name": "Guilherme Blanco", + "email": "guilhermeblanco@gmail.com" + }, + { + "name": "Johannes Schmitt", + "email": "schmittjoh@gmail.com" + } + ], + "description": "Base library for a lexer that can be used in Top-Down, Recursive Descent Parsers.", + "homepage": "http://www.doctrine-project.org", + "keywords": [ + "lexer", + "parser" + ], + "time": "2014-09-09 13:34:57" + }, + { + "name": "igorw/get-in", + "version": "v1.0.3", + "source": { + "type": "git", + "url": "https://github.com/igorw/get-in.git", + "reference": "170ded831f49abc6a6061f655aba9bdbcf7b8111" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/igorw/get-in/zipball/170ded831f49abc6a6061f655aba9bdbcf7b8111", + "reference": "170ded831f49abc6a6061f655aba9bdbcf7b8111", + "shasum": "" + }, + "require": { + "php": ">=5.4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "files": [ + "src/get_in.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Igor Wiedler", + "email": "igor@wiedler.ch" + } + ], + "description": "Functions for for hash map (assoc array) traversal.", + "keywords": [ + "assoc-array", + "hash-map" + ], + "time": "2014-12-15 23:03:51" + }, + { + "name": "joshdifabio/composed", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/joshdifabio/composed.git", + "reference": "ba6019e070679a4bf371bbf92a2093bc73c99d07" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/joshdifabio/composed/zipball/ba6019e070679a4bf371bbf92a2093bc73c99d07", + "reference": "ba6019e070679a4bf371bbf92a2093bc73c99d07", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0-dev" + } + }, + "autoload": { + "psr-4": { + "Composed\\": "src" + }, + "files": [ + "src/functions_include.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Josh Di Fabio", + "email": "joshdifabio@gmail.com" + } + ], + "description": "Easily parse your project's Composer configuration, and those of its dependencies, at runtime.", + "keywords": [ + "composer", + "dependency", + "package" + ], + "time": "2015-07-16 22:30:20" + }, { "name": "league/tactician", "version": "v1.0.2", @@ -58,6 +301,57 @@ ], "time": "2016-02-20 11:14:36" }, + { + "name": "league/tactician-container", + "version": "v1.0.0", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/tactician-container.git", + "reference": "4b75997f6655a574c4b950c7c91714fde9f31d84" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/tactician-container/zipball/4b75997f6655a574c4b950c7c91714fde9f31d84", + "reference": "4b75997f6655a574c4b950c7c91714fde9f31d84", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "^1.1", + "league/tactician": "^1.0", + "php": ">=5.5" + }, + "require-dev": { + "league/container": "~2.0", + "phpunit/phpunit": "~4.3", + "squizlabs/php_codesniffer": "~2.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "League\\Tactician\\Container\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nigel Greenway", + "homepage": "http://futurepixels.co.uk" + } + ], + "description": "Tactician integration for any container implementing the container-interop interface", + "keywords": [ + "container", + "container-interop", + "di", + "interoperable", + "league", + "tactician" + ], + "time": "2015-12-31 12:41:26" + }, { "name": "react/event-loop", "version": "v0.4.2", @@ -146,6 +440,51 @@ "description": "A lightweight implementation of CommonJS Promises/A for PHP", "time": "2016-05-03 17:50:52" }, + { + "name": "wyrihaximus/tactician-command-handler-mapper", + "version": "1.0.0", + "source": { + "type": "git", + "url": "https://github.com/WyriHaximus/php-tactician-command-handler-mapper.git", + "reference": "b34e9669e386f7b3c3f4ae4be3101ba8ab4e3a8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/WyriHaximus/php-tactician-command-handler-mapper/zipball/b34e9669e386f7b3c3f4ae4be3101ba8ab4e3a8a", + "reference": "b34e9669e386f7b3c3f4ae4be3101ba8ab4e3a8a", + "shasum": "" + }, + "require": { + "doctrine/annotations": "^1.2", + "php": "^7.0 || ^5.5" + }, + "require-dev": { + "phake/phake": "^2.3", + "phpunit/phpunit": "^5.0 || ^4.8", + "squizlabs/php_codesniffer": "^2.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "WyriHaximus\\Tactician\\CommandHandler\\": "src/" + }, + "files": [ + "src/bootstrap.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Cees-Jan Kiewiet", + "email": "ceesjank@gmail.com" + } + ], + "description": "Command to Handler mapper for Tactician", + "time": "2016-09-06 09:52:48" + }, { "name": "wyrihaximus/ticking-promise", "version": "1.6.1", @@ -200,20 +539,21 @@ "source": { "type": "git", "url": "https://github.com/php-api-clients/test-utilities.git", - "reference": "9352c32ad2fb7fda6835aa86bce027153b1219a8" + "reference": "0890f53574fa987177e33557680e701f444eaa55" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-api-clients/test-utilities/zipball/9352c32ad2fb7fda6835aa86bce027153b1219a8", - "reference": "9352c32ad2fb7fda6835aa86bce027153b1219a8", + "url": "https://api.github.com/repos/php-api-clients/test-utilities/zipball/0890f53574fa987177e33557680e701f444eaa55", + "reference": "0890f53574fa987177e33557680e701f444eaa55", "shasum": "" }, "require": { + "clue/block-react": "^1.1", "humbug/humbug": "1.0.0-alpha2", "phake/phake": "^2.3", "php": "^7.0", "phpspec/prophecy": "^1.6", - "phpunit/phpunit": "^5.2.3", + "phpunit/phpunit": "^5.6", "squizlabs/php_codesniffer": "^2.6" }, "type": "library", @@ -232,7 +572,7 @@ "email": "ceesjank@gmail.com" } ], - "time": "2016-10-09 10:47:21" + "time": "2016-11-05 22:45:05" }, { "name": "clue/block-react", @@ -405,16 +745,16 @@ }, { "name": "myclabs/deep-copy", - "version": "1.5.4", + "version": "1.5.5", "source": { "type": "git", "url": "https://github.com/myclabs/DeepCopy.git", - "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f" + "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/ea74994a3dc7f8d2f65a06009348f2d63c81e61f", - "reference": "ea74994a3dc7f8d2f65a06009348f2d63c81e61f", + "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/399c1f9781e222f6eb6cc238796f5200d1b7f108", + "reference": "399c1f9781e222f6eb6cc238796f5200d1b7f108", "shasum": "" }, "require": { @@ -443,7 +783,7 @@ "object", "object graph" ], - "time": "2016-09-16 13:37:59" + "time": "2016-10-31 17:19:45" }, { "name": "padraic/humbug_get_contents", @@ -927,16 +1267,16 @@ }, { "name": "phpunit/php-code-coverage", - "version": "4.0.1", + "version": "4.0.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/php-code-coverage.git", - "reference": "5f3f7e736d6319d5f1fc402aff8b026da26709a3" + "reference": "6cba06ff75a1a63a71033e1a01b89056f3af1e8d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/5f3f7e736d6319d5f1fc402aff8b026da26709a3", - "reference": "5f3f7e736d6319d5f1fc402aff8b026da26709a3", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/6cba06ff75a1a63a71033e1a01b89056f3af1e8d", + "reference": "6cba06ff75a1a63a71033e1a01b89056f3af1e8d", "shasum": "" }, "require": { @@ -986,7 +1326,7 @@ "testing", "xunit" ], - "time": "2016-07-26 14:39:29" + "time": "2016-11-01 05:06:24" }, { "name": "phpunit/php-file-iterator", @@ -1171,16 +1511,16 @@ }, { "name": "phpunit/phpunit", - "version": "5.6.1", + "version": "5.6.2", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/phpunit.git", - "reference": "60c32c5b5e79c2248001efa2560f831da11cc2d7" + "reference": "cd13b23ac5a519a4708e00736c26ee0bb28b2e01" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/60c32c5b5e79c2248001efa2560f831da11cc2d7", - "reference": "60c32c5b5e79c2248001efa2560f831da11cc2d7", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/cd13b23ac5a519a4708e00736c26ee0bb28b2e01", + "reference": "cd13b23ac5a519a4708e00736c26ee0bb28b2e01", "shasum": "" }, "require": { @@ -1249,7 +1589,7 @@ "testing", "xunit" ], - "time": "2016-10-07 13:03:26" + "time": "2016-10-25 07:40:25" }, { "name": "phpunit/phpunit-mock-objects", @@ -2000,16 +2340,16 @@ }, { "name": "symfony/console", - "version": "v3.1.5", + "version": "v3.1.6", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "6cb0872fb57b38b3b09ff213c21ed693956b9eb0" + "reference": "c99da1119ae61e15de0e4829196b9fba6f73d065" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/6cb0872fb57b38b3b09ff213c21ed693956b9eb0", - "reference": "6cb0872fb57b38b3b09ff213c21ed693956b9eb0", + "url": "https://api.github.com/repos/symfony/console/zipball/c99da1119ae61e15de0e4829196b9fba6f73d065", + "reference": "c99da1119ae61e15de0e4829196b9fba6f73d065", "shasum": "" }, "require": { @@ -2057,11 +2397,11 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-09-28 00:11:12" + "time": "2016-10-06 01:44:51" }, { "name": "symfony/debug", - "version": "v3.1.5", + "version": "v3.1.6", "source": { "type": "git", "url": "https://github.com/symfony/debug.git", @@ -2118,16 +2458,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.1.5", + "version": "v3.1.6", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5" + "reference": "28b0832b2553ffb80cabef6a7a812ff1e670c0bc" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c0c00c80b3a69132c4e55c3e7db32b4a387615e5", - "reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5", + "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/28b0832b2553ffb80cabef6a7a812ff1e670c0bc", + "reference": "28b0832b2553ffb80cabef6a7a812ff1e670c0bc", "shasum": "" }, "require": { @@ -2174,11 +2514,11 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-07-19 10:45:57" + "time": "2016-10-13 06:28:43" }, { "name": "symfony/finder", - "version": "v3.1.5", + "version": "v3.1.6", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", @@ -2286,7 +2626,7 @@ }, { "name": "symfony/process", - "version": "v3.1.5", + "version": "v3.1.6", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -2335,16 +2675,16 @@ }, { "name": "symfony/yaml", - "version": "v3.1.5", + "version": "v3.1.6", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3" + "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/368b9738d4033c8b93454cb0dbd45d305135a6d3", - "reference": "368b9738d4033c8b93454cb0dbd45d305135a6d3", + "url": "https://api.github.com/repos/symfony/yaml/zipball/7ff51b06c6c3d5cc6686df69004a42c69df09e27", + "reference": "7ff51b06c6c3d5cc6686df69004a42c69df09e27", "shasum": "" }, "require": { @@ -2380,7 +2720,7 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-09-25 08:27:07" + "time": "2016-10-24 18:41:13" }, { "name": "webmozart/assert", diff --git a/src/Factory.php b/src/Factory.php new file mode 100644 index 0000000..0c85ff6 --- /dev/null +++ b/src/Factory.php @@ -0,0 +1,63 @@ +get(LoopInterface::class), + $commandHandlerMiddleware + ); + } + + private static function gatherMapping() + { + $map = []; + /** @var Package $package */ + foreach (packages() as $package) { + $config = $package->getConfig('extra'); + $mapping = get_in( + $config, + [ + 'api-clients', + 'command-bus' + ], + false + ); + + if ($mapping === false) { + continue; + } + + $map += Mapper::map($package->getPath($mapping['path']), $mapping['namespace']); + } + + return $map; + } +} From 26a027197066b443b14836bbfb8abfd7db71ea32 Mon Sep 17 00:00:00 2001 From: Cees-Jan Kiewiet Date: Sun, 13 Nov 2016 19:32:22 +0100 Subject: [PATCH 2/2] Added simple test for the factory plus fixed a minor bug --- composer.json | 1 + composer.lock | 144 +++++++++++++++++++++++++++++++++++++++++- src/Factory.php | 10 ++- tests/FactoryTest.php | 17 +++++ 4 files changed, 167 insertions(+), 5 deletions(-) create mode 100644 tests/FactoryTest.php diff --git a/composer.json b/composer.json index dbb283b..8159e78 100644 --- a/composer.json +++ b/composer.json @@ -24,6 +24,7 @@ "api-clients/test-utilities": "dev-master", "clue/block-react": "^1.1", "phake/phake": "^2.3", + "php-di/php-di": "^5.4", "phpunit/phpunit": "^5.2.3", "squizlabs/php_codesniffer": "^2.6" }, diff --git a/composer.lock b/composer.lock index 7d21aa7..994efb3 100644 --- a/composer.lock +++ b/composer.lock @@ -4,8 +4,8 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file", "This file is @generated automatically" ], - "hash": "862df4f0c3eb4fb05ea61eba80e6aaff", - "content-hash": "5e1dc8af5010e05d4a08b8850e7b9e8d", + "hash": "c89d7dde88adeecd3cd99eaa7c5908b0", + "content-hash": "67b553a4b127e8ddc326b1f6142fe4a6", "packages": [ { "name": "container-interop/container-interop", @@ -1057,6 +1057,146 @@ ], "time": "2016-03-04 18:49:33" }, + { + "name": "php-di/invoker", + "version": "1.3.3", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/Invoker.git", + "reference": "1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/Invoker/zipball/1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7", + "reference": "1f4ca63b9abc66109e53b255e465d0ddb5c2e3f7", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "~1.1" + }, + "require-dev": { + "athletic/athletic": "~0.1.8", + "phpunit/phpunit": "~4.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Invoker\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "Generic and extensible callable invoker", + "homepage": "https://github.com/PHP-DI/Invoker", + "keywords": [ + "callable", + "dependency", + "dependency-injection", + "injection", + "invoke", + "invoker" + ], + "time": "2016-07-14 13:09:58" + }, + { + "name": "php-di/php-di", + "version": "5.4.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/PHP-DI.git", + "reference": "e348393488fa909e4bc0707ba5c9c44cd602a1cb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/PHP-DI/zipball/e348393488fa909e4bc0707ba5c9c44cd602a1cb", + "reference": "e348393488fa909e4bc0707ba5c9c44cd602a1cb", + "shasum": "" + }, + "require": { + "container-interop/container-interop": "~1.0", + "php": ">=5.5.0", + "php-di/invoker": "^1.3.2", + "php-di/phpdoc-reader": "^2.0.1" + }, + "provide": { + "container-interop/container-interop-implementation": "^1.0" + }, + "replace": { + "mnapoli/php-di": "*" + }, + "require-dev": { + "doctrine/annotations": "~1.2", + "doctrine/cache": "~1.4", + "mnapoli/phpunit-easymock": "~0.2.0", + "ocramius/proxy-manager": "~1.0|~2.0", + "phpunit/phpunit": "~4.5" + }, + "suggest": { + "doctrine/annotations": "Install it if you want to use annotations (version ~1.2)", + "doctrine/cache": "Install it if you want to use the cache (version ~1.4)", + "ocramius/proxy-manager": "Install it if you want to use lazy injection (version ~1.0 or ~2.0)" + }, + "type": "library", + "autoload": { + "psr-4": { + "DI\\": "src/DI/" + }, + "files": [ + "src/DI/functions.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "The dependency injection container for humans", + "homepage": "http://php-di.org/", + "keywords": [ + "container", + "dependency injection", + "di" + ], + "time": "2016-08-23 20:18:00" + }, + { + "name": "php-di/phpdoc-reader", + "version": "2.0.1", + "source": { + "type": "git", + "url": "https://github.com/PHP-DI/PhpDocReader.git", + "reference": "83f5ead159defccfa8e7092e5b6c1c533b326d68" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-DI/PhpDocReader/zipball/83f5ead159defccfa8e7092e5b6c1c533b326d68", + "reference": "83f5ead159defccfa8e7092e5b6c1c533b326d68", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "require-dev": { + "phpunit/phpunit": "~4.6" + }, + "type": "library", + "autoload": { + "psr-4": { + "PhpDocReader\\": "src/PhpDocReader" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PhpDocReader parses @var and @param values in PHP docblocks (supports namespaced class names with the same resolution rules as PHP)", + "keywords": [ + "phpdoc", + "reflection" + ], + "time": "2015-11-29 10:34:25" + }, { "name": "phpdocumentor/reflection-common", "version": "1.0", diff --git a/src/Factory.php b/src/Factory.php index 0c85ff6..6a8e59b 100644 --- a/src/Factory.php +++ b/src/Factory.php @@ -42,16 +42,20 @@ private static function gatherMapping() /** @var Package $package */ foreach (packages() as $package) { $config = $package->getConfig('extra'); + + if ($config === null) { + continue; + } + $mapping = get_in( $config, [ 'api-clients', 'command-bus' - ], - false + ] ); - if ($mapping === false) { + if ($mapping === null) { continue; } diff --git a/tests/FactoryTest.php b/tests/FactoryTest.php new file mode 100644 index 0000000..7c4363c --- /dev/null +++ b/tests/FactoryTest.php @@ -0,0 +1,17 @@ +set(LoopInterface::class, $this->prophesize(LoopInterface::class)->reveal()); + $this->assertInstanceOf(CommandBus::class, Factory::create($container)); + } +}