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

GraphController::processBatchQuery()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 19
Code Lines 10

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 19
ccs 0
cts 17
cp 0
rs 9.4285
c 0
b 0
f 0
cc 2
eloc 10
nc 2
nop 2
crap 6
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\Controller;
13
14
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
15
use Symfony\Component\HttpFoundation\JsonResponse;
16
use Symfony\Component\HttpFoundation\Request;
17
18
class GraphController extends Controller
19
{
20
    public function endpointAction(Request $request, $schemaName = null)
21
    {
22
        $payload = $this->processNormalQuery($request, $schemaName);
23
24
        return new JsonResponse($payload, 200);
25
    }
26
27
    public function batchEndpointAction(Request $request, $schemaName = null)
28
    {
29
        $payloads = $this->processBatchQuery($request, $schemaName);
30
31
        return new JsonResponse($payloads, 200);
32
    }
33
34
    private function processBatchQuery(Request $request, $schemaName = null)
35
    {
36
        $queries = $this->get('overblog_graphql.request_batch_parser')->parse($request);
37
        $payloads = [];
38
39
        foreach ($queries as $query) {
40
            $payloadResult = $this->get('overblog_graphql.request_executor')->execute(
41
                [
42
                    'query' => $query['query'],
43
                    'variables' => $query['variables'],
44
                ],
45
                [],
46
                $schemaName
47
            );
48
            $payloads[] = ['id' => $query['id'], 'payload' => $payloadResult->toArray()];
49
        }
50
51
        return $payloads;
52
    }
53
54
    private function processNormalQuery(Request $request, $schemaName = null)
55
    {
56
        $params = $this->get('overblog_graphql.request_parser')->parse($request);
57
        $data = $this->get('overblog_graphql.request_executor')->execute($params, [], $schemaName)->toArray();
58
59
        return $data;
60
    }
61
}
62