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

InterfaceDefinition::removeImplementor()   A

Complexity

Conditions 2
Paths 2

Size

Total Lines 7
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 0
CRAP Score 6

Importance

Changes 0
Metric Value
dl 0
loc 7
c 0
b 0
f 0
ccs 0
cts 4
cp 0
rs 9.4285
cc 2
eloc 3
nc 2
nop 1
crap 6
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