GraphiQLController::indexAction()   B
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 24
Code Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
eloc 14
nc 2
nop 2
dl 0
loc 24
rs 8.9713
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Kreta package.
5
 *
6
 * (c) Beñat Espiña <[email protected]>
7
 * (c) Gorka Laucirica <[email protected]>
8
 *
9
 * For the full copyright and license information, please view the LICENSE
10
 * file that was distributed with this source code.
11
 */
12
13
declare(strict_types=1);
14
15
namespace Kreta\TaskManager\Infrastructure\Symfony\Controller;
16
17
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
18
use Symfony\Component\HttpFoundation\Request;
19
20
class GraphiQLController extends Controller
21
{
22
    public function indexAction(Request $request, $schemaName = null)
23
    {
24
        if (null === $schemaName) {
25
            $endpoint = $this->generateUrl('overblog_graphql_endpoint', [
26
                'access_token' => $request->query->get('access_token'),
27
            ]);
28
        } else {
29
            $endpoint = $this->generateUrl('overblog_graphql_multiple_endpoint', [
30
                'schemaName'   => $schemaName,
31
                'access_token' => $request->query->get('access_token'),
32
            ]);
33
        }
34
35
        return $this->render(
36
            $this->getParameter('overblog_graphql.graphiql_template'),
37
            [
38
                'endpoint' => $endpoint,
39
                'versions' => [
40
                    'graphiql' => $this->getParameter('overblog_graphql.versions.graphiql'),
41
                    'react'    => $this->getParameter('overblog_graphql.versions.react'),
42
                ],
43
            ]
44
        );
45
    }
46
}
47