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

SchemaType   A

Complexity

Total Complexity 5

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 6

Test Coverage

Coverage 100%

Importance

Changes 5
Bugs 1 Features 2
Metric Value
wmc 5
c 5
b 1
f 2
lcom 1
cbo 6
dl 0
loc 44
ccs 15
cts 15
cp 1
rs 10

5 Methods

Rating   Name   Duplication   Size   Complexity  
A setSchema() 0 4 1
A getSchema() 0 4 1
A resolve() 0 4 1
A getName() 0 4 1
A build() 0 8 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
}