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\DeprecateTrait; |
||
16 | use Ynlo\GraphQLBundle\Definition\Traits\ExtensionsAwareTrait; |
||
17 | use Ynlo\GraphQLBundle\Definition\Traits\FieldsAwareDefinitionTrait; |
||
18 | use Ynlo\GraphQLBundle\Definition\Traits\ObjectDefinitionTrait; |
||
19 | use Ynlo\GraphQLBundle\Definition\Traits\PolymorphicDefinitionTrait; |
||
20 | |||
21 | /** |
||
22 | * Class InterfaceDefinition |
||
23 | */ |
||
24 | class InterfaceDefinition implements ObjectDefinitionInterface, HasExtensionsInterface, PolymorphicDefinitionInterface, DeprecateInterface |
||
25 | { |
||
26 | use DefinitionTrait; |
||
27 | use FieldsAwareDefinitionTrait; |
||
28 | use ClassAwareDefinitionTrait; |
||
29 | use ObjectDefinitionTrait; |
||
30 | use ExtensionsAwareTrait; |
||
31 | use PolymorphicDefinitionTrait; |
||
32 | use DeprecateTrait; |
||
33 | |||
34 | /** |
||
35 | * @var string[] |
||
36 | */ |
||
37 | protected $implementors = []; |
||
38 | |||
39 | /** |
||
40 | * @return \string[] |
||
41 | */ |
||
42 | 6 | public function getImplementors(): array |
|
43 | { |
||
44 | 6 | return $this->implementors; |
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
![]() |
|||
45 | } |
||
46 | |||
47 | /** |
||
48 | * @param string $type |
||
49 | */ |
||
50 | 33 | public function addImplementor($type) |
|
51 | { |
||
52 | //a interface can't be implemented by himself |
||
53 | 33 | if ($type === $this->name) { |
|
54 | 32 | return; |
|
55 | } |
||
56 | |||
57 | 33 | $this->implementors[$type] = $type; |
|
58 | 33 | } |
|
59 | |||
60 | /** |
||
61 | * @param string $type |
||
62 | * |
||
63 | * @return $this |
||
64 | */ |
||
65 | 1 | public function removeImplementor($type) |
|
66 | { |
||
67 | 1 | if (isset($this->implementors[$type])) { |
|
68 | 1 | unset($this->implementors[$type]); |
|
69 | } |
||
70 | |||
71 | 1 | return $this; |
|
72 | } |
||
73 | } |
||
74 |