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

Completed
Pull Request — master (#18)
by Jérémiah
09:05
created

GraphDumpSchemaCommand::execute()   B

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 15

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 15
CRAP Score 2

Importance

Changes 3
Bugs 1 Features 3
Metric Value
c 3
b 1
f 3
dl 0
loc 24
ccs 15
cts 15
cp 1
rs 8.9713
cc 2
eloc 15
nc 2
nop 2
crap 2
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\Command;
13
14
use GraphQL\Type\Introspection;
15
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
16
use Symfony\Component\Console\Input\InputInterface;
17
use Symfony\Component\Console\Input\InputOption;
18
use Symfony\Component\Console\Output\OutputInterface;
19
use Symfony\Component\Console\Style\SymfonyStyle;
20
21
class GraphDumpSchemaCommand extends ContainerAwareCommand
22
{
23 1
    protected function configure()
24
    {
25 1
        $this
26 1
            ->setName('graph:dump-schema')
27 1
            ->setDescription('Dumps GraphQL schema')
28 1
            ->addOption(
29 1
                'file',
30 1
                null,
31 1
                InputOption::VALUE_OPTIONAL,
32
                'Path to generate schema file.'
33 1
            );
34 1
    }
35
36 1
    protected function execute(InputInterface $input, OutputInterface $output)
37
    {
38 1
        $output = new SymfonyStyle($input, $output);
39
40
        $request = [
41 1
            'query' => Introspection::getIntrospectionQuery(false),
42 1
            'variables' => [],
43 1
            'operationName' => null,
44 1
        ];
45
46 1
        $container = $this->getContainer();
47
        $result = $container
48 1
            ->get('overblog_graphql.request_executor')
49 1
            ->execute($request)
50 1
            ->toArray();
51
52 1
        $file = $input->hasOption('file') ? $input->getOption('file') : $container->getParameter('kernel.root_dir').'/../var/schema.json';
53
54 1
        $schema = json_encode($result['data']);
55
56 1
        file_put_contents($file, $schema);
57
58 1
        $output->success(sprintf('GraphQL schema "%s" was successfully dumped.', realpath($file)));
59 1
    }
60
}
61