private function 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:

Boolean $required:

string $name:

Return value

array An array of edges

1 call to GraphvizDumper::findEdges()
GraphvizDumper::dump in drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
Dumps the service container as a graphviz graph.

File

drupal/core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php, line 129

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 (is_object($argument) && $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;
}