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