function PhpArrayDumper::dumpCollection

Same name in other branches
  1. 9 core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\PhpArrayDumper::dumpCollection()
  2. 10 core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\PhpArrayDumper::dumpCollection()
  3. 11.x core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\PhpArrayDumper::dumpCollection()

Overrides OptimizedPhpArrayDumper::dumpCollection

File

core/lib/Drupal/Component/DependencyInjection/Dumper/PhpArrayDumper.php, line 32

Class

PhpArrayDumper
PhpArrayDumper dumps a service container as a PHP array.

Namespace

Drupal\Component\DependencyInjection\Dumper

Code

protected function dumpCollection($collection, &$resolve = FALSE) {
    $code = [];
    foreach ($collection as $key => $value) {
        if (is_array($value)) {
            $code[$key] = $this->dumpCollection($value);
        }
        else {
            $code[$key] = $this->dumpValue($value);
        }
    }
    return $code;
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.