Completed
Pull Request — master (#4)
by Yonel Ceruto
08:00
created

SchemaController   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 14
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 14
ccs 0
cts 8
cp 0
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 3 1
A __invoke() 0 5 1
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