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 (#137)
by Jérémiah
08:18
created

XmlParser   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 30
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Test Coverage

Coverage 100%

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A parse() 0 21 4
1
<?php
2
3
/*
4
 * This file is part of the OverblogGraphQLBundle package.
5
 *
6
 * (c) Overblog <http://github.com/overblog/>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace Overblog\GraphQLBundle\Config\Parser;
13
14
use Symfony\Component\Config\Resource\FileResource;
15
use Symfony\Component\Config\Util\XmlUtils;
16
use Symfony\Component\DependencyInjection\ContainerBuilder;
17
use Symfony\Component\DependencyInjection\Exception\InvalidArgumentException;
18
use Symfony\Component\Finder\SplFileInfo;
19
20
class XmlParser implements ParserInterface
21
{
22
    /*
23
     * @param SplFileInfo      $file
24
     * @param ContainerBuilder $container
25
     *
26
     * @return array
27
     */
28 3
    public static function parse(SplFileInfo $file, ContainerBuilder $container)
29
    {
30 3
        $typesConfig = [];
31
32
        try {
33
            //@todo fix xml validateSchema
34 3
            $xml = XmlUtils::loadFile($file->getRealPath());
35 2
            foreach ($xml->documentElement->childNodes as $node) {
36 2
                if (!$node instanceof \DOMElement) {
37 2
                    continue;
38
                }
39 2
                $values = XmlUtils::convertDomElementToArray($node);
40 2
                $typesConfig = array_merge($typesConfig, $values);
41 2
            }
42 2
            $container->addResource(new FileResource($file->getRealPath()));
43 3
        } catch (\InvalidArgumentException $e) {
44 1
            throw new InvalidArgumentException(sprintf('Unable to parse file "%s".', $file), $e->getCode(), $e);
45
        }
46
47 2
        return $typesConfig;
48
    }
49
}
50