Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Passed
Pull Request — master (#235)
by Jérémiah
10:32
created

XmlParser   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 5
lcom 0
cbo 5
dl 0
loc 31
ccs 13
cts 13
cp 1
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
B parse() 0 22 5
1
<?php
2
3
namespace Overblog\GraphQLBundle\Config\Parser;
4
5
use Symfony\Component\Config\Resource\FileResource;
6
use Symfony\Component\Config\Util\XmlUtils;
7
use Symfony\Component\DependencyInjection\ContainerBuilder;
8
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
9
use Symfony\Component\Finder\SplFileInfo;
10
11
class XmlParser implements ParserInterface
12
{
13
    /**
14
     * @param SplFileInfo      $file
15
     * @param ContainerBuilder $container
16
     *
17
     * @return array
18
     */
19 2
    public static function parse(SplFileInfo $file, ContainerBuilder $container)
20
    {
21 2
        $typesConfig = [];
22
23
        try {
24 2
            $xml = XmlUtils::loadFile($file->getRealPath());
25 1
            foreach ($xml->documentElement->childNodes as $node) {
26 1
                if (!$node instanceof \DOMElement) {
27 1
                    continue;
28
                }
29 1
                $values = XmlUtils::convertDomElementToArray($node);
30 1
                if (is_array($values)) {
31 1
                    $typesConfig = array_merge($typesConfig, $values);
32
                }
33
            }
34 1
            $container->addResource(new FileResource($file->getRealPath()));
35 1
        } catch (\InvalidArgumentException $e) {
36 1
            throw new InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e);
37
        }
38
39 1
        return $typesConfig;
40
    }
41
}
42