Completed
Pull Request — master (#37)
by Sam
02:44
created

NodeInterfaceType::build()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace Digia\Lumen\GraphQL\Types;
4
5
use Digia\Lumen\GraphQL\Traits\ResolvesTypeTrait;
6
use Youshido\GraphQL\Relay\Field\GlobalIdField;
7
use Youshido\GraphQL\Type\InterfaceType\AbstractInterfaceType;
8
9
class NodeInterfaceType extends AbstractInterfaceType
10
{
11
12
    use ResolvesTypeTrait;
13
14
    /**
15
     * @var string
16
     */
17
    private $typeName;
18
19
    /**
20
     * NodeInterface constructor.
21
     *
22
     * @param string $typeName
23
     */
24
    public function __construct($typeName)
25
    {
26
        parent::__construct();
27
28
        $this->typeName = $typeName;
29
    }
30
31
    /**
32
     * @inheritdoc
33
     */
34
    public function build($config)
35
    {
36
        $config->addField(new GlobalIdField($this->typeName));
37
    }
38
}
39