function GraphvizDumper::findEdges
Finds all edges belonging to a specific service id.
1 call to GraphvizDumper::findEdges()
- GraphvizDumper::dump in vendor/
symfony/ dependency-injection/ Dumper/ GraphvizDumper.php - Dumps the service container as a graphviz graph.
File
-
vendor/
symfony/ dependency-injection/ Dumper/ GraphvizDumper.php, line 112
Class
- GraphvizDumper
- GraphvizDumper dumps a service container as a graphviz file.
Namespace
Symfony\Component\DependencyInjection\DumperCode
private function findEdges(string $id, array $arguments, bool $required, string $name, bool $lazy = false) : array {
$edges = [];
foreach ($arguments as $argument) {
if ($argument instanceof Parameter) {
$argument = $this->container
->hasParameter($argument) ? $this->container
->getParameter($argument) : null;
}
elseif (\is_string($argument) && preg_match('/^%([^%]+)%$/', $argument, $match)) {
$argument = $this->container
->hasParameter($match[1]) ? $this->container
->getParameter($match[1]) : null;
}
if ($argument instanceof Reference) {
$lazyEdge = $lazy;
if (!$this->container
->has((string) $argument)) {
$this->nodes[(string) $argument] = [
'name' => $name,
'required' => $required,
'class' => '',
'attributes' => $this->options['node.missing'],
];
}
elseif ('service_container' !== (string) $argument) {
$lazyEdge = $lazy || $this->container
->getDefinition((string) $argument)
->isLazy();
}
$edges[] = [
[
'name' => $name,
'required' => $required,
'to' => $argument,
'lazy' => $lazyEdge,
],
];
}
elseif ($argument instanceof ArgumentInterface) {
$edges[] = $this->findEdges($id, $argument->getValues(), $required, $name, true);
}
elseif ($argument instanceof Definition) {
$edges[] = $this->findEdges($id, $argument->getArguments(), $required, '');
$edges[] = $this->findEdges($id, $argument->getProperties(), false, '');
foreach ($argument->getMethodCalls() as $call) {
$edges[] = $this->findEdges($id, $call[1], false, $call[0] . '()');
}
}
elseif (\is_array($argument)) {
$edges[] = $this->findEdges($id, $argument, $required, $name, $lazy);
}
}
return array_merge([], ...$edges);
}