You are here

private function GraphvizDumper::findEdges in Zircon Profile 8.0

Same name and namespace in other branches
  1. 8 vendor/symfony/dependency-injection/Dumper/GraphvizDumper.php \Symfony\Component\DependencyInjection\Dumper\GraphvizDumper::findEdges()

Finds all edges belonging to a specific service id.

Parameters

string $id The service id used to find edges:

array $arguments An array of arguments:

bool $required:

string $name:

Return value

array An array of edges

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 133

Class

GraphvizDumper
GraphvizDumper dumps a service container as a graphviz file.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function findEdges($id, $arguments, $required, $name) {
  $edges = array();
  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) {
      if (!$this->container
        ->has((string) $argument)) {
        $this->nodes[(string) $argument] = array(
          'name' => $name,
          'required' => $required,
          'class' => '',
          'attributes' => $this->options['node.missing'],
        );
      }
      $edges[] = array(
        'name' => $name,
        'required' => $required,
        'to' => $argument,
      );
    }
    elseif (is_array($argument)) {
      $edges = array_merge($edges, $this
        ->findEdges($id, $argument, $required, $name));
    }
  }
  return $edges;
}