Code Duplication    Length = 9-10 lines in 5 locations

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

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