Completed
Push — master ( 998494...8e3b13 )
by Rafael
10s
created

SchemaController::__invoke()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 2

Importance

Changes 0
Metric Value
dl 0
loc 5
ccs 0
cts 4
cp 0
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
crap 2
1
<?php
2
/*******************************************************************************
3
 *  This file is part of the GraphQL Bundle package.
4
 *
5
 *  (c) YnloUltratech <[email protected]>
6
 *
7
 *  For the full copyright and license information, please view the LICENSE
8
 *  file that was distributed with this source code.
9
 ******************************************************************************/
10
11
namespace Ynlo\GraphQLBundle\Controller;
12
13
use GraphQL\Utils\SchemaPrinter;
14
use Symfony\Component\HttpFoundation\Response;
15
use Ynlo\GraphQLBundle\Schema\SchemaCompiler;
16
17
class SchemaController
18
{
19
    private $compiler;
20
21
    public function __construct(SchemaCompiler $compiler)
22
    {
23
        $this->compiler = $compiler;
24
    }
25
26
    public function __invoke(): Response
27
    {
28
        $schema = $this->compiler->compile();
29
30
        return new Response(SchemaPrinter::doPrint($schema));
31
    }
32
}
33