1 | <?php declare(strict_types = 1); |
||
18 | class MethodDefinition extends AbstractDefinition implements MethodBuilderInterface |
||
19 | { |
||
20 | /** @var string Method name */ |
||
21 | protected $methodName; |
||
22 | /** @var ParameterDefinition[] Collection of parameter collection */ |
||
23 | protected $parametersCollection = []; |
||
24 | /** @var int Method modifiers */ |
||
25 | protected $modifiers = 0; |
||
26 | /** @var bool Flag that method is public */ |
||
27 | protected $isPublic = false; |
||
28 | |||
29 | /** |
||
30 | * Define arguments |
||
31 | * |
||
32 | * @param string $parameterName |
||
33 | * @return ParameterBuilderInterface |
||
34 | * @throws ParameterDefinitionAlreadyExistsException |
||
35 | */ |
||
36 | 13 | public function defineParameter($parameterName): ParameterBuilderInterface |
|
49 | |||
50 | /** |
||
51 | * @return string |
||
52 | */ |
||
53 | 2 | public function getMethodName(): string |
|
57 | |||
58 | /** |
||
59 | * @return boolean |
||
60 | */ |
||
61 | 3 | public function isPublic(): bool |
|
65 | |||
66 | /** |
||
67 | * @param boolean $isPublic |
||
68 | * @return MethodDefinition |
||
69 | */ |
||
70 | 4 | public function setIsPublic(bool $isPublic): MethodDefinition |
|
76 | |||
77 | /** |
||
78 | * @param string $methodName |
||
79 | * @return MethodDefinition |
||
80 | */ |
||
81 | 16 | public function setMethodName(string $methodName): MethodDefinition |
|
87 | |||
88 | /** |
||
89 | * @return int |
||
90 | */ |
||
91 | 1 | public function getModifiers(): int |
|
95 | |||
96 | /** |
||
97 | * @param int $modifiers |
||
98 | * @return MethodDefinition |
||
99 | */ |
||
100 | 4 | public function setModifiers(int $modifiers): MethodDefinition |
|
106 | |||
107 | /** |
||
108 | * @return ParameterDefinition[] |
||
109 | */ |
||
110 | 4 | public function getParametersCollection(): array |
|
114 | |||
115 | /** |
||
116 | * Set correct order of parameter definitions |
||
117 | * |
||
118 | * @param array $order Correct ordered parameter names |
||
119 | * @throws \InvalidArgumentException |
||
120 | */ |
||
121 | 4 | public function setParametersCollectionOrder(array $order) |
|
148 | |||
149 | /** |
||
150 | * Has parameter definition |
||
151 | * |
||
152 | * @param string $parameterName |
||
153 | * @return bool |
||
154 | */ |
||
155 | 4 | public function hasParameter(string $parameterName): bool |
|
159 | |||
160 | /** |
||
161 | * Get property definition |
||
162 | * |
||
163 | * @param $parameterName |
||
164 | * @return ParameterDefinition |
||
165 | * @throws ParameterDefinitionNotFoundException |
||
166 | */ |
||
167 | 4 | public function getParameter($parameterName): ParameterDefinition |
|
174 | |||
175 | /** |
||
176 | * Get existing or define new parameter |
||
177 | * |
||
178 | * @param string $parameterName |
||
179 | * @return ParameterDefinition |
||
180 | * @throws ParameterDefinitionNotFoundException |
||
181 | * @throws ParameterDefinitionAlreadyExistsException |
||
182 | */ |
||
183 | 4 | public function setupParameter(string $parameterName): ParameterDefinition |
|
192 | } |
||
193 |