Code Duplication    Length = 15-17 lines in 4 locations

lib/Drupal/Component/DependencyInjection/Dumper/OptimizedPhpArrayDumper.php 1 location

@@ 173-189 (lines=17) @@
170
   * @return array
171
   *   The escaped parameters.
172
   */
173
  protected function escape(array $parameters) {
174
    $args = array();
175
176
    foreach ($parameters as $key => $value) {
177
      if (is_array($value)) {
178
        $args[$key] = $this->escape($value);
179
      }
180
      elseif (is_string($value)) {
181
        $args[$key] = str_replace('%', '%%', $value);
182
      }
183
      else {
184
        $args[$key] = $value;
185
      }
186
    }
187
188
    return $args;
189
  }
190
191
  /**
192
   * Gets a service definition as PHP array.

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/XmlDumper.php 1 location

@@ 314-328 (lines=15) @@
311
     *
312
     * @return array
313
     */
314
    private function escape($arguments)
315
    {
316
        $args = array();
317
        foreach ($arguments as $k => $v) {
318
            if (is_array($v)) {
319
                $args[$k] = $this->escape($v);
320
            } elseif (is_string($v)) {
321
                $args[$k] = str_replace('%', '%%', $v);
322
            } else {
323
                $args[$k] = $v;
324
            }
325
        }
326
327
        return $args;
328
    }
329
330
    /**
331
     * Converts php types to xml types.

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Dumper/YamlDumper.php 1 location

@@ 330-344 (lines=15) @@
327
     *
328
     * @return array
329
     */
330
    private function escape($arguments)
331
    {
332
        $args = array();
333
        foreach ($arguments as $k => $v) {
334
            if (is_array($v)) {
335
                $args[$k] = $this->escape($v);
336
            } elseif (is_string($v)) {
337
                $args[$k] = str_replace('%', '%%', $v);
338
            } else {
339
                $args[$k] = $v;
340
            }
341
        }
342
343
        return $args;
344
    }
345
}
346

lib/Drupal/Core/DependencyInjection/Dumper/PhpArrayDumper.php 1 location

@@ 124-140 (lines=17) @@
121
   * @return array
122
   *   The escaped arguments.
123
   */
124
  protected function escape($arguments)
125
  {
126
    $args = array();
127
    foreach ($arguments as $k => $v) {
128
      if (is_array($v)) {
129
        $args[$k] = $this->escape($v);
130
      }
131
      elseif (is_string($v)) {
132
        $args[$k] = str_replace('%', '%%', $v);
133
      }
134
      else {
135
        $args[$k] = $v;
136
      }
137
    }
138
139
    return $args;
140
  }
141
142
  /**
143
   * Gets a service definition as PHP array.