Passed
Push — master ( c39fb6...9e9a0d )
by Rafael
04:42
created

ObjectDefinition::addInterface()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
ccs 2
cts 2
cp 1
crap 1
rs 10
c 0
b 0
f 0
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\Definition;
12
13
use Ynlo\GraphQLBundle\Definition\Traits\ClassAwareDefinitionTrait;
14
use Ynlo\GraphQLBundle\Definition\Traits\DefinitionTrait;
15
use Ynlo\GraphQLBundle\Definition\Traits\FieldsAwareDefinitionTrait;
16
use Ynlo\GraphQLBundle\Definition\Traits\ObjectDefinitionTrait;
17
18
/**
19
 * Class ObjectDefinition
20
 */
21
class ObjectDefinition implements ObjectDefinitionInterface, NodeAwareDefinitionInterface
22
{
23
    use DefinitionTrait;
24
    use FieldsAwareDefinitionTrait;
25
    use ClassAwareDefinitionTrait;
26
    use ObjectDefinitionTrait;
27
28
    /**
29
     * @var string[]
30
     */
31
    protected $interfaces = [];
32
33
    /**
34
     * @return string[]
35
     */
36 1
    public function getInterfaces(): array
37
    {
38 1
        return $this->interfaces;
39
    }
40
41
    /**
42
     * @param string $name
43
     */
44 1
    public function addInterface(string $name)
45
    {
46 1
        $this->interfaces[] = $name;
47 1
    }
48
49
    /**
50
     * {@inheritDoc}
51
     */
52
    public function setNode(?string $node): NodeAwareDefinitionInterface
53
    {
54
        $this->setClass($node);
55
56
        return $this;
57
    }
58
59
    /**
60
     * {@inheritDoc}
61
     */
62 1
    public function getNode(): ?string
63
    {
64 1
        return $this->getClass();
65
    }
66
}
67