function OptimizedPhpArrayDumper::prepareParameters

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

Prepares parameters for the PHP array dumping.

Parameters

array $parameters: An array of parameters.

bool $escape: Whether keys with '%' should be escaped or not.

Return value

array An array of prepared parameters.

1 call to OptimizedPhpArrayDumper::prepareParameters()
OptimizedPhpArrayDumper::getParameters in core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
Gets parameters of the container as a PHP array.

File

core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php, line 155

Class

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

Namespace

Drupal\Component\DependencyInjection\Dumper

Code

protected function prepareParameters(array $parameters, $escape = TRUE) {
    $filtered = [];
    foreach ($parameters as $key => $value) {
        if (is_array($value)) {
            $value = $this->prepareParameters($value, $escape);
        }
        $filtered[$key] = $value;
    }
    return $escape ? $this->escape($filtered) : $filtered;
}

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