protected function OptimizedPhpArrayDumper::dumpCollection in Service Container 7
Same name and namespace in other branches
- 7.2 lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::dumpCollection()
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.
2 calls to OptimizedPhpArrayDumper::dumpCollection()
- OptimizedPhpArrayDumper::dumpMethodCalls in lib/
Drupal/ Component/ DependencyInjection/ Dumper/ OptimizedPhpArrayDumper.php - Dumps method calls to a PHP array.
- OptimizedPhpArrayDumper::getServiceDefinition in lib/
Drupal/ Component/ DependencyInjection/ Dumper/ OptimizedPhpArrayDumper.php - Gets a service definition as PHP array.
1 method overrides OptimizedPhpArrayDumper::dumpCollection()
- PhpArrayDumper::dumpCollection in lib/
Drupal/ Component/ DependencyInjection/ Dumper/ PhpArrayDumper.php - Dumps a collection to a PHP array.
File
- lib/
Drupal/ Component/ DependencyInjection/ Dumper/ OptimizedPhpArrayDumper.php, line 309 - Contains \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper.
Class
- OptimizedPhpArrayDumper
- OptimizedPhpArrayDumper dumps a service container as a serialized PHP array.
Namespace
Drupal\Component\DependencyInjection\DumperCode
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,
);
}