You are here

private function GraphvizDumper::findNodes in Service Container 7

Same name and namespace in other branches
  1. 7.2 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/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 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/GraphvizDumper.php
Dumps the service container as a graphviz graph.

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/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) {
    $className = $definition
      ->getClass();
    try {
      $className = $this->container
        ->getParameterBag()
        ->resolveValue($className);
    } catch (ParameterNotFoundException $e) {
    }
    $nodes[$id] = array(
      'class' => str_replace('\\', '\\\\', $className),
      '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;
}