Code Duplication    Length = 9-10 lines in 5 locations

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

@@ 89-98 (lines=10) @@
86
            return;
87
        }
88
89
        if (false === is_array($service)) {
90
            throw new InvalidArgumentException(
91
                sprintf(
92
                    'A service definition must be an array or a string starting with "@" but %s found for service "%s" in %s. Check your YAML syntax.',
93
                    gettype($service),
94
                    $id,
95
                    $fileName
96
                )
97
            );
98
        }
99
100
        if (isset($service['alias'])) {
101
            $aliasName = $service['alias'];
@@ 184-192 (lines=9) @@
181
        }
182
183
        $tags = [];
184
        if (false === is_array($service['tags'])) {
185
            throw new InvalidArgumentException(
186
                sprintf(
187
                    'Parameter "tags" must be an array for service "%s" in %s. Check your YAML syntax.',
188
                    $id,
189
                    $fileName
190
                )
191
            );
192
        }
193
194
        foreach ($service['tags'] as $tag) {
195
            if (false === is_array($tag)) {
@@ 252-260 (lines=9) @@
249
            return [];
250
        }
251
252
        if (false === is_array($service['autowiringTypes'])) {
253
            throw new InvalidArgumentException(
254
                sprintf(
255
                    'Parameter "autowiringTypes" must be an array for service "%s" in %s. Check your YAML syntax.',
256
                    $id,
257
                    $fileName
258
                )
259
            );
260
        }
261
262
        $autowiringTypes = [];
263
        foreach ($service['autowiringTypes'] as $autowiringType) {
@@ 292-301 (lines=10) @@
289
     */
290
    private function parseFactory(ServiceInterface $service, $factory, $fileName)
291
    {
292
        if (false === is_array($factory)) {
293
            throw new InvalidArgumentException(
294
                sprintf(
295
                    'Parameter "factory" must be an array for service "%s", but found "%s" instead in %s. Check your YAML syntax.',
296
                    $service->getName(),
297
                    gettype($factory),
298
                    $fileName
299
                )
300
            );
301
        }
302
303
        if (2 !== count($factory)) {
304
            throw new InvalidArgumentException(
@@ 303-312 (lines=10) @@
300
            );
301
        }
302
303
        if (2 !== count($factory)) {
304
            throw new InvalidArgumentException(
305
                sprintf(
306
                    'Parameter "factory" expects two parameters for service "%s", but found "%s" instead in %s. Check your YAML syntax.',
307
                    $service->getName(),
308
                    gettype($factory),
309
                    $fileName
310
                )
311
            );
312
        }
313
314
        $factoryClass = $factory[0];
315
        $factoryMethod = $factory[1];