You are here

protected function OptimizedPhpArrayDumper::escape in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::escape()

Escapes parameters.

Parameters

array $parameters: The parameters to escape for '%' characters.

Return value

array The escaped parameters.

1 call to OptimizedPhpArrayDumper::escape()
OptimizedPhpArrayDumper::prepareParameters in core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php
Prepares parameters for the PHP array dumping.

File

core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php, line 173
Contains \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper.

Class

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

Namespace

Drupal\Component\DependencyInjection\Dumper

Code

protected function escape(array $parameters) {
  $args = array();
  foreach ($parameters as $key => $value) {
    if (is_array($value)) {
      $args[$key] = $this
        ->escape($value);
    }
    elseif (is_string($value)) {
      $args[$key] = str_replace('%', '%%', $value);
    }
    else {
      $args[$key] = $value;
    }
  }
  return $args;
}