Total Complexity | 4 |
Total Lines | 30 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
20 | class ExtendType |
||
21 | { |
||
22 | /** |
||
23 | * @var string |
||
24 | */ |
||
25 | private $class; |
||
26 | |||
27 | /** |
||
28 | * @param mixed[] $attributes |
||
29 | */ |
||
30 | public function __construct(array $attributes = []) |
||
31 | { |
||
32 | if (!isset($attributes['class'])) { |
||
33 | throw new BadMethodCallException('In annotation @ExtendType, missing compulsory parameter "class".'); |
||
34 | } |
||
35 | $this->class = $attributes['class']; |
||
36 | if (!class_exists($this->class)) { |
||
37 | throw ClassNotFoundException::couldNotFindClass($this->class); |
||
38 | } |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Returns the name of the GraphQL query/mutation/field. |
||
43 | * If not specified, the name of the method should be used instead. |
||
44 | * |
||
45 | * @return string |
||
46 | */ |
||
47 | public function getClass(): string |
||
50 | } |
||
51 | } |
||
52 |