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

ObjectDefinition   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 44
Duplicated Lines 0 %

Test Coverage

Coverage 70%

Importance

Changes 0
Metric Value
dl 0
loc 44
ccs 7
cts 10
cp 0.7
rs 10
c 0
b 0
f 0
wmc 4

4 Methods

Rating   Name   Duplication   Size   Complexity  
A getInterfaces() 0 3 1
A getNode() 0 3 1
A setNode() 0 5 1
A addInterface() 0 3 1
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