protected OptimizedPhpArrayDumper::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.
File
- core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php, line 310
Class
- OptimizedPhpArrayDumper
- OptimizedPhpArrayDumper dumps a service container as a serialized 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)) { $resolve_collection = FALSE; $code[$key] = $this->dumpCollection($value, $resolve_collection); if ($resolve_collection) { $resolve = TRUE; } } else { if (is_object($value)) { $resolve = TRUE; } $code[$key] = $this->dumpValue($value); } } if (!$resolve) { return $collection; } return (object) array( 'type' => 'collection', 'value' => $code, 'resolve' => $resolve, ); }
Please login to continue.