Code Duplication    Length = 10-10 lines in 5 locations

src/FileLoader/Parser/Yaml/DefinitionsParser.php 5 locations

@@ 155-164 (lines=10) @@
152
                )
153
            );
154
        }
155
        if (false === is_string($service['class'])) {
156
            throw new InvalidArgumentException(
157
                sprintf(
158
                    'Parameter "class" must be a FQCN for service "%s", but found "%s" instead in %s. Check your YAML syntax.',
159
                    $id,
160
                    gettype($service['class']),
161
                    $fileName
162
                )
163
            );
164
        }
165
166
        return $service['class'];
167
    }
@@ 316-325 (lines=10) @@
313
314
        $factoryClass = $factory[0];
315
        $factoryMethod = $factory[1];
316
        if (false === is_string($factoryClass)) {
317
            throw new InvalidArgumentException(
318
                sprintf(
319
                    'The first parameter of "factory" for service "%s" must be a class name or a reference to a service, but found "%s" instead in %s. Check your YAML syntax.',
320
                    $service->getName(),
321
                    gettype($factoryClass),
322
                    $fileName
323
                )
324
            );
325
        }
326
        $factoryClass = $this->serviceResolver->resolve($factoryClass);
327
328
        if (false === is_string($factoryMethod)) {
@@ 328-337 (lines=10) @@
325
        }
326
        $factoryClass = $this->serviceResolver->resolve($factoryClass);
327
328
        if (false === is_string($factoryMethod)) {
329
            throw new InvalidArgumentException(
330
                sprintf(
331
                    'The second parameter of "factory" for service "%s" must be a class name or a reference to a service, but found "%s" instead in %s. Check your YAML syntax.',
332
                    $service->getName(),
333
                    gettype($factoryMethod),
334
                    $fileName
335
                )
336
            );
337
        }
338
339
       return new Factory($service, $factoryClass, $factoryMethod);
340
    }
@@ 354-363 (lines=10) @@
351
     */
352
    private function parseDecoration(ServiceInterface $service, $decoration, $fileName)
353
    {
354
        if (false === is_string($decoration['decorates'])) {
355
            throw new InvalidArgumentException(
356
                sprintf(
357
                    'Parameter "decorates" for service "%s" must be the id of another service, but found "%s" instead in %s. Check your YAML syntax.',
358
                    $service->getName(),
359
                    gettype($decoration['decorates']),
360
                    $fileName
361
                )
362
            );
363
        }
364
        $decorates = $decoration['decorates'];
365
366
        $decorationInnerName = (isset($decoration['decoration_inner_name'])) ? $decoration['decoration_inner_name'] : null;
@@ 367-376 (lines=10) @@
364
        $decorates = $decoration['decorates'];
365
366
        $decorationInnerName = (isset($decoration['decoration_inner_name'])) ? $decoration['decoration_inner_name'] : null;
367
        if (null !== $decorationInnerName && false === is_string($decorationInnerName)) {
368
            throw new InvalidArgumentException(
369
                sprintf(
370
                    'Parameter "decoration_inner_name" for service "%s" must be a string if is set, but found "%s" instead in %s. Check your YAML syntax.',
371
                    $service->getName(),
372
                    gettype($decorationInnerName),
373
                    $fileName
374
                )
375
            );
376
        }
377
378
        return new Decoration($service, $decorates, $decorationInnerName);
379
    }