Code Duplication    Length = 26-26 lines in 2 locations

lib/Drupal/Core/DependencyInjection/YamlFileLoader.php 1 location

@@ 249-274 (lines=26) @@
246
            }
247
        }
248
249
        if (isset($service['tags'])) {
250
            if (!is_array($service['tags'])) {
251
                throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
252
            }
253
254
            foreach ($service['tags'] as $tag) {
255
                if (!is_array($tag)) {
256
                    throw new InvalidArgumentException(sprintf('A "tags" entry must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
257
                }
258
259
                if (!isset($tag['name'])) {
260
                    throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file));
261
                }
262
263
                $name = $tag['name'];
264
                unset($tag['name']);
265
266
                foreach ($tag as $attribute => $value) {
267
                    if (!is_scalar($value) && null !== $value) {
268
                        throw new InvalidArgumentException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in %s. Check your YAML syntax.', $id, $name, $attribute, $file));
269
                    }
270
                }
271
272
                $definition->addTag($name, $tag);
273
            }
274
        }
275
276
        if (isset($service['decorates'])) {
277
            $renameId = isset($service['decoration_inner_name']) ? $service['decoration_inner_name'] : null;

modules/providers/service_container_symfony/lib/Symfony/Component/DependencyInjection/Loader/YamlFileLoader.php 1 location

@@ 257-282 (lines=26) @@
254
            }
255
        }
256
257
        if (isset($service['tags'])) {
258
            if (!is_array($service['tags'])) {
259
                throw new InvalidArgumentException(sprintf('Parameter "tags" must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
260
            }
261
262
            foreach ($service['tags'] as $tag) {
263
                if (!is_array($tag)) {
264
                    throw new InvalidArgumentException(sprintf('A "tags" entry must be an array for service "%s" in %s. Check your YAML syntax.', $id, $file));
265
                }
266
267
                if (!isset($tag['name'])) {
268
                    throw new InvalidArgumentException(sprintf('A "tags" entry is missing a "name" key for service "%s" in %s.', $id, $file));
269
                }
270
271
                $name = $tag['name'];
272
                unset($tag['name']);
273
274
                foreach ($tag as $attribute => $value) {
275
                    if (!is_scalar($value) && null !== $value) {
276
                        throw new InvalidArgumentException(sprintf('A "tags" attribute must be of a scalar-type for service "%s", tag "%s", attribute "%s" in %s. Check your YAML syntax.', $id, $name, $attribute, $file));
277
                    }
278
                }
279
280
                $definition->addTag($name, $tag);
281
            }
282
        }
283
284
        if (isset($service['decorates'])) {
285
            $renameId = isset($service['decoration_inner_name']) ? $service['decoration_inner_name'] : null;