Avoid duplicating edges when there is multiple extended services

This commit is contained in:
jubianchi 2017-01-05 13:02:11 +01:00
parent 2cbdce51c6
commit 3e0cab2547
No known key found for this signature in database
GPG key ID: 5D9C896D2AA9E390
3 changed files with 202 additions and 72 deletions

View file

@ -1,5 +1,6 @@
# `1.0.0` (unreleased) # `1.0.0` (unreleased)
* Avoid duplicating edges when there is multiple extended services
* Display extended services as components with inverted arrows * Display extended services as components with inverted arrows
* Display services as components * Display services as components
* Display volumes as folders * Display volumes as folders

256
composer.lock generated
View file

@ -145,37 +145,87 @@
"time": "2015-03-08 10:30:28" "time": "2015-03-08 10:30:28"
}, },
{ {
"name": "symfony/console", "name": "psr/log",
"version": "v3.1.3", "version": "1.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/console.git", "url": "https://github.com/php-fig/log.git",
"reference": "f9e638e8149e9e41b570ff092f8007c477ef0ce5" "reference": "4ebe3a8bf773a19edfe0a84b6585ba3d401b724d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/console/zipball/f9e638e8149e9e41b570ff092f8007c477ef0ce5", "url": "https://api.github.com/repos/php-fig/log/zipball/4ebe3a8bf773a19edfe0a84b6585ba3d401b724d",
"reference": "f9e638e8149e9e41b570ff092f8007c477ef0ce5", "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": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.5.9", "php": ">=5.5.9",
"symfony/debug": "~2.8|~3.0",
"symfony/polyfill-mbstring": "~1.0" "symfony/polyfill-mbstring": "~1.0"
}, },
"require-dev": { "require-dev": {
"psr/log": "~1.0", "psr/log": "~1.0",
"symfony/event-dispatcher": "~2.8|~3.0", "symfony/event-dispatcher": "~2.8|~3.0",
"symfony/filesystem": "~2.8|~3.0",
"symfony/process": "~2.8|~3.0" "symfony/process": "~2.8|~3.0"
}, },
"suggest": { "suggest": {
"psr/log": "For using the console logger", "psr/log": "For using the console logger",
"symfony/event-dispatcher": "", "symfony/event-dispatcher": "",
"symfony/filesystem": "",
"symfony/process": "" "symfony/process": ""
}, },
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.1-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -202,20 +252,77 @@
], ],
"description": "Symfony Console Component", "description": "Symfony Console Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-07-26 08:04:17" "time": "2016-12-11 14:34:22"
}, },
{ {
"name": "symfony/polyfill-mbstring", "name": "symfony/debug",
"version": "v1.2.0", "version": "v3.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/polyfill-mbstring.git", "url": "https://github.com/symfony/debug.git",
"reference": "dff51f72b0706335131b00a7f49606168c582594" "reference": "9f923e68d524a3095c5a2ae5fc7220c7cbc12231"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/dff51f72b0706335131b00a7f49606168c582594", "url": "https://api.github.com/repos/symfony/debug/zipball/9f923e68d524a3095c5a2ae5fc7220c7cbc12231",
"reference": "dff51f72b0706335131b00a7f49606168c582594", "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": "" "shasum": ""
}, },
"require": { "require": {
@ -227,7 +334,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "1.2-dev" "dev-master": "1.3-dev"
} }
}, },
"autoload": { "autoload": {
@ -261,29 +368,35 @@
"portable", "portable",
"shim" "shim"
], ],
"time": "2016-05-18 14:26:46" "time": "2016-11-14 01:06:16"
}, },
{ {
"name": "symfony/yaml", "name": "symfony/yaml",
"version": "v3.1.3", "version": "v3.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/yaml.git", "url": "https://github.com/symfony/yaml.git",
"reference": "1819adf2066880c7967df7180f4f662b6f0567ac" "reference": "a7095af4b97a0955f85c8989106c249fa649011f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/yaml/zipball/1819adf2066880c7967df7180f4f662b6f0567ac", "url": "https://api.github.com/repos/symfony/yaml/zipball/a7095af4b97a0955f85c8989106c249fa649011f",
"reference": "1819adf2066880c7967df7180f4f662b6f0567ac", "reference": "a7095af4b97a0955f85c8989106c249fa649011f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": ">=5.5.9" "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", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.1-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -310,22 +423,22 @@
], ],
"description": "Symfony Yaml Component", "description": "Symfony Yaml Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-07-17 14:02:08" "time": "2016-12-10 10:07:06"
} }
], ],
"packages-dev": [ "packages-dev": [
{ {
"name": "crysalead/kahlan", "name": "crysalead/kahlan",
"version": "2.5.4", "version": "2.5.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/crysalead/kahlan.git", "url": "https://github.com/crysalead/kahlan.git",
"reference": "0f5deb7faa3a7a324bf0dc0186190ea18bc1eff3" "reference": "64e48c213ee3af4d7d6fe1c13d907f77f11ca5d4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/crysalead/kahlan/zipball/0f5deb7faa3a7a324bf0dc0186190ea18bc1eff3", "url": "https://api.github.com/repos/crysalead/kahlan/zipball/64e48c213ee3af4d7d6fe1c13d907f77f11ca5d4",
"reference": "0f5deb7faa3a7a324bf0dc0186190ea18bc1eff3", "reference": "64e48c213ee3af4d7d6fe1c13d907f77f11ca5d4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -363,39 +476,40 @@
"testing", "testing",
"unit test" "unit test"
], ],
"time": "2016-06-15 15:07:49" "abandoned": "kahlan/kahlan",
"time": "2016-08-18 13:29:17"
}, },
{ {
"name": "friendsofphp/php-cs-fixer", "name": "friendsofphp/php-cs-fixer",
"version": "v1.11.6", "version": "v1.13.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git",
"reference": "41dc93abd2937a85a3889e28765231d574d2bac8" "reference": "0ea4f7ed06ca55da1d8fc45da26ff87f261c4088"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/41dc93abd2937a85a3889e28765231d574d2bac8", "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/0ea4f7ed06ca55da1d8fc45da26ff87f261c4088",
"reference": "41dc93abd2937a85a3889e28765231d574d2bac8", "reference": "0ea4f7ed06ca55da1d8fc45da26ff87f261c4088",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"ext-tokenizer": "*", "ext-tokenizer": "*",
"php": ">=5.3.6", "php": "^5.3.6 || >=7.0 <7.2",
"sebastian/diff": "~1.1", "sebastian/diff": "^1.1",
"symfony/console": "~2.3|~3.0", "symfony/console": "^2.3 || ^3.0",
"symfony/event-dispatcher": "~2.1|~3.0", "symfony/event-dispatcher": "^2.1 || ^3.0",
"symfony/filesystem": "~2.1|~3.0", "symfony/filesystem": "^2.1 || ^3.0",
"symfony/finder": "~2.1|~3.0", "symfony/finder": "^2.1 || ^3.0",
"symfony/process": "~2.3|~3.0", "symfony/process": "^2.3 || ^3.0",
"symfony/stopwatch": "~2.5|~3.0" "symfony/stopwatch": "^2.5 || ^3.0"
}, },
"conflict": { "conflict": {
"hhvm": "<3.9" "hhvm": "<3.9"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "^4.5|^5", "phpunit/phpunit": "^4.5|^5",
"satooshi/php-coveralls": "^0.7.1" "satooshi/php-coveralls": "^1.0"
}, },
"bin": [ "bin": [
"php-cs-fixer" "php-cs-fixer"
@ -421,7 +535,7 @@
} }
], ],
"description": "A tool to automatically fix PHP code style", "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", "name": "sebastian/diff",
@ -477,16 +591,16 @@
}, },
{ {
"name": "symfony/event-dispatcher", "name": "symfony/event-dispatcher",
"version": "v3.1.3", "version": "v3.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/event-dispatcher.git", "url": "https://github.com/symfony/event-dispatcher.git",
"reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5" "reference": "e8f47a327c2f0fd5aa04fa60af2b693006ed7283"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/c0c00c80b3a69132c4e55c3e7db32b4a387615e5", "url": "https://api.github.com/repos/symfony/event-dispatcher/zipball/e8f47a327c2f0fd5aa04fa60af2b693006ed7283",
"reference": "c0c00c80b3a69132c4e55c3e7db32b4a387615e5", "reference": "e8f47a327c2f0fd5aa04fa60af2b693006ed7283",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -506,7 +620,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.1-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -533,20 +647,20 @@
], ],
"description": "Symfony EventDispatcher Component", "description": "Symfony EventDispatcher Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-07-19 10:45:57" "time": "2016-10-13 06:29:04"
}, },
{ {
"name": "symfony/filesystem", "name": "symfony/filesystem",
"version": "v3.1.3", "version": "v3.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/filesystem.git", "url": "https://github.com/symfony/filesystem.git",
"reference": "bb29adceb552d202b6416ede373529338136e84f" "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/filesystem/zipball/bb29adceb552d202b6416ede373529338136e84f", "url": "https://api.github.com/repos/symfony/filesystem/zipball/8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4",
"reference": "bb29adceb552d202b6416ede373529338136e84f", "reference": "8d4cf7561a5b17e5eb7a02b80d0b8f014a3796d4",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -555,7 +669,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.1-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -582,20 +696,20 @@
], ],
"description": "Symfony Filesystem Component", "description": "Symfony Filesystem Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-07-20 05:44:26" "time": "2016-11-24 00:46:43"
}, },
{ {
"name": "symfony/finder", "name": "symfony/finder",
"version": "v3.1.3", "version": "v3.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/finder.git", "url": "https://github.com/symfony/finder.git",
"reference": "8201978de88a9fa0923e18601bb17f1df9c721e7" "reference": "a69cb5d455b4885ca376dc5bb3e1155cc8c08c4b"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/finder/zipball/8201978de88a9fa0923e18601bb17f1df9c721e7", "url": "https://api.github.com/repos/symfony/finder/zipball/a69cb5d455b4885ca376dc5bb3e1155cc8c08c4b",
"reference": "8201978de88a9fa0923e18601bb17f1df9c721e7", "reference": "a69cb5d455b4885ca376dc5bb3e1155cc8c08c4b",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -604,7 +718,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.1-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -631,20 +745,20 @@
], ],
"description": "Symfony Finder Component", "description": "Symfony Finder Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-06-29 05:41:56" "time": "2016-12-13 09:39:43"
}, },
{ {
"name": "symfony/process", "name": "symfony/process",
"version": "v3.1.3", "version": "v3.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/process.git", "url": "https://github.com/symfony/process.git",
"reference": "04c2dfaae4ec56a5c677b0c69fac34637d815758" "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/process/zipball/04c2dfaae4ec56a5c677b0c69fac34637d815758", "url": "https://api.github.com/repos/symfony/process/zipball/02ea84847aad71be7e32056408bb19f3a616cdd3",
"reference": "04c2dfaae4ec56a5c677b0c69fac34637d815758", "reference": "02ea84847aad71be7e32056408bb19f3a616cdd3",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -653,7 +767,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.1-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -680,20 +794,20 @@
], ],
"description": "Symfony Process Component", "description": "Symfony Process Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-07-28 11:13:48" "time": "2016-11-24 10:40:28"
}, },
{ {
"name": "symfony/stopwatch", "name": "symfony/stopwatch",
"version": "v3.1.3", "version": "v3.2.1",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/symfony/stopwatch.git", "url": "https://github.com/symfony/stopwatch.git",
"reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1" "reference": "5b139e1c4290e6c7640ba80d9c9b5e49ef22b841"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/symfony/stopwatch/zipball/bb42806b12c5f89db4ebf64af6741afe6d8457e1", "url": "https://api.github.com/repos/symfony/stopwatch/zipball/5b139e1c4290e6c7640ba80d9c9b5e49ef22b841",
"reference": "bb42806b12c5f89db4ebf64af6741afe6d8457e1", "reference": "5b139e1c4290e6c7640ba80d9c9b5e49ef22b841",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -702,7 +816,7 @@
"type": "library", "type": "library",
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.1-dev" "dev-master": "3.2-dev"
} }
}, },
"autoload": { "autoload": {
@ -729,7 +843,7 @@
], ],
"description": "Symfony Stopwatch Component", "description": "Symfony Stopwatch Component",
"homepage": "https://symfony.com", "homepage": "https://symfony.com",
"time": "2016-06-29 05:41:56" "time": "2016-06-29 05:43:10"
} }
], ],
"aliases": [], "aliases": [],

View file

@ -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 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); $edge->setAttribute('docker_compose.type', $type);
if ($alias !== null) { if ($alias !== null) {