Completed
Pull Request — master (#19)
by David
03:53
created

AbstractAnnotatedObjectType   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
dl 0
loc 21
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 4 1
A build() 0 5 1
1
<?php
2
3
4
namespace TheCodingMachine\GraphQL\Controllers;
5
6
7
use TheCodingMachine\GraphQL\Controllers\Registry\RegistryInterface;
8
use Youshido\GraphQL\Config\Object\ObjectTypeConfig;
9
use Youshido\GraphQL\Type\Object\AbstractObjectType;
10
11
abstract class AbstractAnnotatedObjectType extends AbstractObjectType
12
{
13
    /**
14
     * @var RegistryInterface
15
     */
16
    private $registry;
17
18
    public function __construct(RegistryInterface $registry)
19
    {
20
        $this->registry = $registry;
21
        parent::__construct([]);
22
    }
23
24
    /**
25
     * @param ObjectTypeConfig $config
26
     */
27
    public function build($config)
28
    {
29
        $fieldProvider = new ControllerQueryProvider($this, $this->registry);
30
        $fields = $fieldProvider->getFields();
31
        $this->addFields($fields);
32
    }
33
}