You are here

protected function PhpArrayDumper::escape 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::escape()

Escapes arguments.

Parameters

array $arguments: The arguments to escape.

Return value

array The escaped arguments.

1 call to PhpArrayDumper::escape()
PhpArrayDumper::prepareParameters in lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php
Prepares parameters.

File

lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php, line 124
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 escape($arguments) {
  $args = array();
  foreach ($arguments as $k => $v) {
    if (is_array($v)) {
      $args[$k] = $this
        ->escape($v);
    }
    elseif (is_string($v)) {
      $args[$k] = str_replace('%', '%%', $v);
    }
    else {
      $args[$k] = $v;
    }
  }
  return $args;
}