You are here

private function GraphvizDumper::findNodes in Zircon Profile 8

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

Finds all nodes.

Return value

array An array of all nodes

1 call to GraphvizDumper::findNodes()
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 162

Class

GraphvizDumper
GraphvizDumper dumps a service container as a graphviz file.

Namespace

Symfony\Component\DependencyInjection\Dumper

Code

private function findNodes() {
  $nodes = array();
  $container = $this
    ->cloneContainer();
  foreach ($container
    ->getDefinitions() as $id => $definition) {
    $class = $definition
      ->getClass();
    if ('\\' === substr($class, 0, 1)) {
      $class = substr($class, 1);
    }
    try {
      $class = $this->container
        ->getParameterBag()
        ->resolveValue($class);
    } catch (ParameterNotFoundException $e) {
    }
    $nodes[$id] = array(
      'class' => str_replace('\\', '\\\\', $class),
      'attributes' => array_merge($this->options['node.definition'], array(
        'style' => ContainerInterface::SCOPE_PROTOTYPE !== $definition
          ->getScope() ? 'filled' : 'dotted',
      )),
    );
    $container
      ->setDefinition($id, new Definition('stdClass'));
  }
  foreach ($container
    ->getServiceIds() as $id) {
    $service = $container
      ->get($id);
    if (array_key_exists($id, $container
      ->getAliases())) {
      continue;
    }
    if (!$container
      ->hasDefinition($id)) {
      $class = 'service_container' === $id ? get_class($this->container) : get_class($service);
      $nodes[$id] = array(
        'class' => str_replace('\\', '\\\\', $class),
        'attributes' => $this->options['node.instance'],
      );
    }
  }
  return $nodes;
}