Passed
Push — master ( 319fcb...7a107a )
by Rafael
04:41
created

InterfaceDefinition   A

Complexity

Total Complexity 4

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Test Coverage

Coverage 55.56%

Importance

Changes 0
Metric Value
wmc 4
dl 0
loc 41
c 0
b 0
f 0
ccs 5
cts 9
cp 0.5556
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A getImplementors() 0 3 1
A addImplementor() 0 3 1
A removeImplementor() 0 7 2
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\ExtensionsAwareTrait;
16
use Ynlo\GraphQLBundle\Definition\Traits\FieldsAwareDefinitionTrait;
17
use Ynlo\GraphQLBundle\Definition\Traits\ObjectDefinitionTrait;
18
19
/**
20
 * Class InterfaceDefinition
21
 */
22
class InterfaceDefinition implements ObjectDefinitionInterface, HasExtensionsInterface
23
{
24
    use DefinitionTrait;
25
    use FieldsAwareDefinitionTrait;
26
    use ClassAwareDefinitionTrait;
27
    use ObjectDefinitionTrait;
28
    use ExtensionsAwareTrait;
29
30
    /**
31
     * @var string[]
32
     */
33
    protected $implementors = [];
34
35
    /**
36
     * @return \string[]
37
     */
38 22
    public function getImplementors(): array
39
    {
40 22
        return $this->implementors;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->implementors returns the type string[] which is incompatible with the documented return type string[].
Loading history...
41
    }
42
43
    /**
44
     * @param string $type
45
     */
46 1
    public function addImplementor($type)
47
    {
48 1
        $this->implementors[$type] = $type;
49 1
    }
50
51
    /**
52
     * @param string $type
53
     *
54
     * @return $this
55
     */
56
    public function removeImplementor($type)
57
    {
58
        if (isset($this->implementors[$type])) {
59
            unset($this->implementors[$type]);
60
        }
61
62
        return $this;
63
    }
64
}
65