You are here

protected function PhpArrayDumper::prepareParameters in Service Container 7.2

Same name and namespace in other branches
  1. 7 lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php \Drupal\Core\DependencyInjection\Dumper\PhpArrayDumper::prepareParameters()

Prepares parameters.

Parameters

array $parameters:

bool $escape:

Return value

array

1 call to PhpArrayDumper::prepareParameters()
PhpArrayDumper::getParameters in lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php
Returns parameters of the container as a PHP Array.

File

lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php, line 98
Contains \Drupal\Core\DependencyInjection\Dumper\PhpArrayDumper

Class

PhpArrayDumper
PhpArrayDumper dumps a service container as a serialized PHP array.

Namespace

Drupal\Core\DependencyInjection\Dumper

Code

protected function prepareParameters($parameters, $escape = true) {
  $filtered = array();
  foreach ($parameters as $key => $value) {
    if (is_array($value)) {
      $value = $this
        ->prepareParameters($value, $escape);
    }
    elseif ($value instanceof Reference) {
      $value = '@' . $value;
    }
    $filtered[$key] = $value;
  }
  return $escape ? $this
    ->escape($filtered) : $filtered;
}