function OptimizedPhpArrayDumper::escape
Same name in other branches
- 9 core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::escape()
- 10 core/lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php \Drupal\Component\DependencyInjection\Dumper\OptimizedPhpArrayDumper::escape()
- 11.x 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 178
Class
- OptimizedPhpArrayDumper
- OptimizedPhpArrayDumper dumps a service container as a serialized PHP array.
Namespace
Drupal\Component\DependencyInjection\DumperCode
protected function escape(array $parameters) {
$args = [];
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;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.