protected function PhpArrayDumper::dumpCollection

protected PhpArrayDumper::dumpCollection($collection, &$resolve = FALSE)

Dumps a collection to a PHP array.

Parameters

mixed $collection: A collection to process.

bool &$resolve: Used for passing the information to the caller whether the given collection needed to be resolved or not. This is used for optimizing deep arrays that don't need to be traversed.

Return value

\stdClass|array The collection in a suitable format.

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 = array();

  foreach ($collection as $key => $value) {
    if (is_array($value)) {
      $code[$key] = $this->dumpCollection($value);
    }
    else {
      $code[$key] = $this->dumpValue($value);
    }
  }

  return $code;
}

© 2001–2016 by the original authors
Licensed under the GNU General Public License, version 2 and later.
Drupal is a registered trademark of Dries Buytaert.
https://api.drupal.org/api/drupal/core!lib!Drupal!Component!DependencyInjection!Dumper!PhpArrayDumper.php/function/PhpArrayDumper::dumpCollection/8.1.x