You are here

public function ParameterBag::escapeValue in Service Container 7.2

Same name and namespace in other branches
  1. 7 modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php \Symfony\Component\DependencyInjection\ParameterBag\ParameterBag::escapeValue()

Escape parameter placeholders %.

Parameters

mixed $value:

Return value

mixed

Overrides ParameterBagInterface::escapeValue

File

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/ParameterBag/ParameterBag.php, line 269

Class

ParameterBag
Holds parameters.

Namespace

Symfony\Component\DependencyInjection\ParameterBag

Code

public function escapeValue($value) {
  if (is_string($value)) {
    return str_replace('%', '%%', $value);
  }
  if (is_array($value)) {
    $result = array();
    foreach ($value as $k => $v) {
      $result[$k] = $this
        ->escapeValue($v);
    }
    return $result;
  }
  return $value;
}