Completed
Push — master ( f9f0ef...24a695 )
by Portey
05:15
created

SchemaType::resolve()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 2
Bugs 0 Features 1
Metric Value
c 2
b 0
f 1
dl 0
loc 4
ccs 2
cts 2
cp 1
rs 10
cc 1
eloc 2
nc 1
nop 2
crap 1
1
<?php
2
/**
3
 * Date: 03.12.15
4
 *
5
 * @author Portey Vasil <[email protected]>
6
 */
7
8
namespace Youshido\GraphQL\Definition;
9
10
use Youshido\GraphQL\Schema;
11
use Youshido\GraphQL\Type\Config\TypeConfigInterface;
12
use Youshido\GraphQL\Type\Object\AbstractObjectType;
13
14
class SchemaType extends AbstractObjectType
15
{
16
17
    /** @var  Schema */
18
    public static $schema;
19
20
    /**
21
     * @param $schema Schema
22
     */
23 18
    public function setSchema($schema)
24
    {
25 18
        self::$schema = $schema;
26 18
    }
27
28
    /**
29
     * @return Schema
30
     */
31 4
    public function getSchema()
32
    {
33 4
        return self::$schema;
34
    }
35
36 4
    public function resolve($value = null, $args = [])
37
    {
38 4
        return $this->getSchema();
39
    }
40
41
    /**
42
     * @return String type name
43
     */
44 18
    public function getName()
45
    {
46 18
        return '__Schema';
47
    }
48
49 5
    protected function build(TypeConfigInterface $config)
50
    {
51
        $config
52 5
            ->addField('queryType', new QueryType())
53 5
            ->addField('mutationType', new MutationType())
54 5
            ->addField('types', new QueryListType())
55 5
            ->addField('directives', new DirectiveListType());
56
    }
57
}