OptimizedPhpArrayDumper::escape

protected OptimizedPhpArrayDumper::escape(array $parameters)

Escapes parameters.

Parameters

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

Return value

array The escaped parameters.

File

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

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;
}
doc_Drupal
2016-10-29 09:32:36
Comments
Leave a Comment

Please login to continue.