diff --git a/CHANGELOG.md b/CHANGELOG.md index 0d1d68b..0035e26 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,6 @@ # `1.0.0` (unreleased) +* Avoid duplicating edges when there is multiple extended services * Display extended services as components with inverted arrows * Display services as components * Display volumes as folders diff --git a/composer.lock b/composer.lock index a538a6b..70160e5 100644 --- a/composer.lock +++ b/composer.lock @@ -145,37 +145,87 @@ "time": "2015-03-08 10:30:28" }, { - "name": "symfony/console", - "version": "v3.1.3", + "name": "psr/log", + "version": "1.0.2", "source": { "type": "git", - "url": "https://github.com/symfony/console.git", - "reference": "f9e638e8149e9e41b570ff092f8007c477ef0ce5" + "url": "https://github.com/php-fig/log.git", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/f9e638e8149e9e41b570ff092f8007c477ef0ce5", - "reference": "f9e638e8149e9e41b570ff092f8007c477ef0ce5", + "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d", + "shasum": "" + }, + "require": { + "php": ">=5.3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.0.x-dev" + } + }, + "autoload": { + "psr-4": { + "Psr\\Log\\": "Psr/Log/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "PHP-FIG", + "homepage": "http://www.php-fig.org/" + } + ], + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", + "keywords": [ + "log", + "psr", + "psr-3" + ], + "time": "2016-10-10 12:19:37" + }, + { + "name": "symfony/console", + "version": "v3.2.1", + "source": { + "type": "git", + "url": "https://github.com/symfony/console.git", + "reference": "d12aa9ca20f4db83ec58410978dab6afcb9d6aaa" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/console/zipball/d12aa9ca20f4db83ec58410978dab6afcb9d6aaa", + "reference": "d12aa9ca20f4db83ec58410978dab6afcb9d6aaa", "shasum": "" }, "require": { "php": ">=5.5.9", + "symfony/debug": "~2.8|~3.0", "symfony/polyfill-mbstring": "~1.0" }, "require-dev": { "psr/log": "~1.0", "symfony/event-dispatcher": "~2.8|~3.0", + "symfony/filesystem": "~2.8|~3.0", "symfony/process": "~2.8|~3.0" }, "suggest": { "psr/log": "For using the console logger", "symfony/event-dispatcher": "", + "symfony/filesystem": "", "symfony/process": "" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -202,20 +252,77 @@ ], "description": "Symfony Console Component", "homepage": "https://symfony.com", - "time": "2016-07-26 08:04:17" + "time": "2016-12-11 14:34:22" }, { - "name": "symfony/polyfill-mbstring", - "version": "v1.2.0", + "name": "symfony/debug", + "version": "v3.2.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "dff51f72b0706335131b00a7f49606168c582594" + "url": "https://github.com/symfony/debug.git", + "reference": "9f923e68d524a3095c5a2ae5fc7220c7cbc12231" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", - "reference": "dff51f72b0706335131b00a7f49606168c582594", + "url": "https://api.github.com/repos/symfony/debug/zipball/9f923e68d524a3095c5a2ae5fc7220c7cbc12231", + "reference": "9f923e68d524a3095c5a2ae5fc7220c7cbc12231", + "shasum": "" + }, + "require": { + "php": ">=5.5.9", + "psr/log": "~1.0" + }, + "conflict": { + "symfony/http-kernel": ">=2.3,<2.3.24|~2.4.0|>=2.5,<2.5.9|>=2.6,<2.6.2" + }, + "require-dev": { + "symfony/class-loader": "~2.8|~3.0", + "symfony/http-kernel": "~2.8|~3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.2-dev" + } + }, + "autoload": { + "psr-4": { + "Symfony\\Component\\Debug\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "Symfony Debug Component", + "homepage": "https://symfony.com", + "time": "2016-11-16 22:18:16" + }, + { + "name": "symfony/polyfill-mbstring", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/symfony/polyfill-mbstring.git", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/e79d363049d1c2128f133a2667e4f4190904f7f4", + "reference": "e79d363049d1c2128f133a2667e4f4190904f7f4", "shasum": "" }, "require": { @@ -227,7 +334,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "1.2-dev" + "dev-master": "1.3-dev" } }, "autoload": { @@ -261,29 +368,35 @@ "portable", "shim" ], - "time": "2016-05-18 14:26:46" + "time": "2016-11-14 01:06:16" }, { "name": "symfony/yaml", - "version": "v3.1.3", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/yaml.git", - "reference": "1819adf2066880c7967df7180f4f662b6f0567ac" + "reference": "a7095af4b97a0955f85c8989106c249fa649011f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/yaml/zipball/1819adf2066880c7967df7180f4f662b6f0567ac", - "reference": "1819adf2066880c7967df7180f4f662b6f0567ac", + "url": "https://api.github.com/repos/symfony/yaml/zipball/a7095af4b97a0955f85c8989106c249fa649011f", + "reference": "a7095af4b97a0955f85c8989106c249fa649011f", "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.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -310,22 +423,22 @@ ], "description": "Symfony Yaml Component", "homepage": "https://symfony.com", - "time": "2016-07-17 14:02:08" + "time": "2016-12-10 10:07:06" } ], "packages-dev": [ { "name": "crysalead/kahlan", - "version": "2.5.4", + "version": "2.5.6", "source": { "type": "git", "url": "https://github.com/crysalead/kahlan.git", - "reference": "0f5deb7faa3a7a324bf0dc0186190ea18bc1eff3" + "reference": "64e48c213ee3af4d7d6fe1c13d907f77f11ca5d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/crysalead/kahlan/zipball/0f5deb7faa3a7a324bf0dc0186190ea18bc1eff3", - "reference": "0f5deb7faa3a7a324bf0dc0186190ea18bc1eff3", + "url": "https://api.github.com/repos/crysalead/kahlan/zipball/64e48c213ee3af4d7d6fe1c13d907f77f11ca5d4", + "reference": "64e48c213ee3af4d7d6fe1c13d907f77f11ca5d4", "shasum": "" }, "require": { @@ -363,39 +476,40 @@ "testing", "unit test" ], - "time": "2016-06-15 15:07:49" + "abandoned": "kahlan/kahlan", + "time": "2016-08-18 13:29:17" }, { "name": "friendsofphp/php-cs-fixer", - "version": "v1.11.6", + "version": "v1.13.1", "source": { "type": "git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", - "reference": "41dc93abd2937a85a3889e28765231d574d2bac8" + "reference": "0ea4f7ed06ca55da1d8fc45da26ff87f261c4088" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/41dc93abd2937a85a3889e28765231d574d2bac8", - "reference": "41dc93abd2937a85a3889e28765231d574d2bac8", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/0ea4f7ed06ca55da1d8fc45da26ff87f261c4088", + "reference": "0ea4f7ed06ca55da1d8fc45da26ff87f261c4088", "shasum": "" }, "require": { "ext-tokenizer": "*", - "php": ">=5.3.6", - "sebastian/diff": "~1.1", - "symfony/console": "~2.3|~3.0", - "symfony/event-dispatcher": "~2.1|~3.0", - "symfony/filesystem": "~2.1|~3.0", - "symfony/finder": "~2.1|~3.0", - "symfony/process": "~2.3|~3.0", - "symfony/stopwatch": "~2.5|~3.0" + "php": "^5.3.6 || >=7.0 <7.2", + "sebastian/diff": "^1.1", + "symfony/console": "^2.3 || ^3.0", + "symfony/event-dispatcher": "^2.1 || ^3.0", + "symfony/filesystem": "^2.1 || ^3.0", + "symfony/finder": "^2.1 || ^3.0", + "symfony/process": "^2.3 || ^3.0", + "symfony/stopwatch": "^2.5 || ^3.0" }, "conflict": { "hhvm": "<3.9" }, "require-dev": { "phpunit/phpunit": "^4.5|^5", - "satooshi/php-coveralls": "^0.7.1" + "satooshi/php-coveralls": "^1.0" }, "bin": [ "php-cs-fixer" @@ -421,7 +535,7 @@ } ], "description": "A tool to automatically fix PHP code style", - "time": "2016-07-22 06:46:28" + "time": "2016-12-01 00:05:05" }, { "name": "sebastian/diff", @@ -477,16 +591,16 @@ }, { "name": "symfony/event-dispatcher", - "version": "v3.1.3", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/event-dispatcher.git", - "reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5" + "reference": "e8f47a327c2f0fd5aa04fa60af2b693006ed7283" }, "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/e8f47a327c2f0fd5aa04fa60af2b693006ed7283", + "reference": "e8f47a327c2f0fd5aa04fa60af2b693006ed7283", "shasum": "" }, "require": { @@ -506,7 +620,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -533,20 +647,20 @@ ], "description": "Symfony EventDispatcher Component", "homepage": "https://symfony.com", - "time": "2016-07-19 10:45:57" + "time": "2016-10-13 06:29:04" }, { "name": "symfony/filesystem", - "version": "v3.1.3", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/filesystem.git", - "reference": "bb29adceb552d202b6416ede373529338136e84f" + "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/filesystem/zipball/bb29adceb552d202b6416ede373529338136e84f", - "reference": "bb29adceb552d202b6416ede373529338136e84f", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", + "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4", "shasum": "" }, "require": { @@ -555,7 +669,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -582,20 +696,20 @@ ], "description": "Symfony Filesystem Component", "homepage": "https://symfony.com", - "time": "2016-07-20 05:44:26" + "time": "2016-11-24 00:46:43" }, { "name": "symfony/finder", - "version": "v3.1.3", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/finder.git", - "reference": "8201978de88a9fa0923e18601bb17f1df9c721e7" + "reference": "a69cb5d455b4885ca376dc5bb3e1155cc8c08c4b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/finder/zipball/8201978de88a9fa0923e18601bb17f1df9c721e7", - "reference": "8201978de88a9fa0923e18601bb17f1df9c721e7", + "url": "https://api.github.com/repos/symfony/finder/zipball/a69cb5d455b4885ca376dc5bb3e1155cc8c08c4b", + "reference": "a69cb5d455b4885ca376dc5bb3e1155cc8c08c4b", "shasum": "" }, "require": { @@ -604,7 +718,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -631,20 +745,20 @@ ], "description": "Symfony Finder Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:41:56" + "time": "2016-12-13 09:39:43" }, { "name": "symfony/process", - "version": "v3.1.3", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/process.git", - "reference": "04c2dfaae4ec56a5c677b0c69fac34637d815758" + "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/process/zipball/04c2dfaae4ec56a5c677b0c69fac34637d815758", - "reference": "04c2dfaae4ec56a5c677b0c69fac34637d815758", + "url": "https://api.github.com/repos/symfony/process/zipball/02ea84847aad71be7e32056408bb19f3a616cdd3", + "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3", "shasum": "" }, "require": { @@ -653,7 +767,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -680,20 +794,20 @@ ], "description": "Symfony Process Component", "homepage": "https://symfony.com", - "time": "2016-07-28 11:13:48" + "time": "2016-11-24 10:40:28" }, { "name": "symfony/stopwatch", - "version": "v3.1.3", + "version": "v3.2.1", "source": { "type": "git", "url": "https://github.com/symfony/stopwatch.git", - "reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1" + "reference": "5b139e1c4290e6c7640ba80d9c9b5e49ef22b841" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/stopwatch/zipball/bb42806b12c5f89db4ebf64af6741afe6d8457e1", - "reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1", + "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5b139e1c4290e6c7640ba80d9c9b5e49ef22b841", + "reference": "5b139e1c4290e6c7640ba80d9c9b5e49ef22b841", "shasum": "" }, "require": { @@ -702,7 +816,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "3.1-dev" + "dev-master": "3.2-dev" } }, "autoload": { @@ -729,7 +843,7 @@ ], "description": "Symfony Stopwatch Component", "homepage": "https://symfony.com", - "time": "2016-06-29 05:41:56" + "time": "2016-06-29 05:43:10" } ], "aliases": [], diff --git a/src/functions.php b/src/functions.php index e4f32fa..9b27ce7 100644 --- a/src/functions.php +++ b/src/functions.php @@ -409,7 +409,22 @@ function addNetwork(Graph $graph, string $name, string $type = null) */ function addRelation(Vertex $from, Vertex $to, string $type, string $alias = null, bool $bidirectional = false) : Edge\Directed { - $edge = $from->createEdgeTo($to); + $edge = null; + + if ($from->hasEdgeTo($to)) { + $edges = $from->getEdgesTo($to); + + foreach ($edges as $edge) { + if ($edge->getAttribute('docker_compose.type') === $type) { + break; + } + } + } + + if (null === $edge) { + $edge = $from->createEdgeTo($to); + } + $edge->setAttribute('docker_compose.type', $type); if ($alias !== null) {