1 | <?php declare(strict_types=1); |
||
30 | abstract class BaseRule implements RuleInterface |
||
31 | { |
||
32 | /** |
||
33 | * State key. |
||
34 | */ |
||
35 | const STATE_ERROR_VALUE = 0; |
||
36 | |||
37 | /** |
||
38 | * State key. |
||
39 | */ |
||
40 | const STATE_LAST = self::STATE_ERROR_VALUE; |
||
41 | |||
42 | /** |
||
43 | * Property key. |
||
44 | */ |
||
45 | const PROPERTY_NAME = 0; |
||
46 | |||
47 | /** |
||
48 | * Property key. |
||
49 | */ |
||
50 | const PROPERTY_IS_CAPTURE_ENABLED = self::PROPERTY_NAME + 1; |
||
51 | |||
52 | /** |
||
53 | * Property key. |
||
54 | */ |
||
55 | const PROPERTY_LAST = self::PROPERTY_IS_CAPTURE_ENABLED; |
||
56 | |||
57 | /** |
||
58 | * @var string|null |
||
59 | */ |
||
60 | private $name = null; |
||
61 | |||
62 | /** |
||
63 | * @var bool |
||
64 | */ |
||
65 | private $isCaptureEnabled = false; |
||
66 | |||
67 | /** |
||
68 | * @var RuleInterface|null |
||
69 | */ |
||
70 | private $parent = null; |
||
71 | |||
72 | /** |
||
73 | * @inheritdoc |
||
74 | */ |
||
75 | 33 | public function getName(): string |
|
83 | |||
84 | /** |
||
85 | * @inheritdoc |
||
86 | */ |
||
87 | 28 | public function setName(string $name): RuleInterface |
|
93 | |||
94 | /** |
||
95 | * @inheritdoc |
||
96 | */ |
||
97 | 1 | public function unsetName(): RuleInterface |
|
103 | |||
104 | /** |
||
105 | * @inheritdoc |
||
106 | */ |
||
107 | 29 | public function enableCapture(): RuleInterface |
|
113 | |||
114 | /** |
||
115 | * @inheritdoc |
||
116 | */ |
||
117 | 1 | public function disableCapture(): RuleInterface |
|
123 | |||
124 | /** |
||
125 | * @inheritdoc |
||
126 | */ |
||
127 | 33 | public function isCaptureEnabled(): bool |
|
131 | |||
132 | /** |
||
133 | * @inheritdoc |
||
134 | */ |
||
135 | 18 | public function getParent(): ?RuleInterface |
|
139 | |||
140 | /** |
||
141 | * @inheritdoc |
||
142 | */ |
||
143 | 18 | public function setParent(RuleInterface $rule): RuleInterface |
|
149 | |||
150 | /** |
||
151 | * @inheritdoc |
||
152 | */ |
||
153 | 1 | public function unsetParent(): RuleInterface |
|
159 | |||
160 | /** |
||
161 | * @return array |
||
162 | */ |
||
163 | 32 | protected function getStandardProperties(): array |
|
167 | |||
168 | /** |
||
169 | * @param string $name |
||
170 | * @param bool $isCaptureEnabled |
||
171 | * |
||
172 | * @return array |
||
173 | */ |
||
174 | 32 | protected function composeStandardProperties(string $name, bool $isCaptureEnabled): array |
|
181 | |||
182 | /** |
||
183 | * @param iterable $messageParams |
||
184 | * |
||
185 | * @return bool |
||
186 | */ |
||
187 | 17 | protected function checkEachValueConvertibleToString(iterable $messageParams): bool |
|
201 | |||
202 | /** |
||
203 | * @param mixed $result |
||
204 | * |
||
205 | * @return array |
||
206 | * |
||
207 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
208 | */ |
||
209 | 16 | protected static function createSuccessReply($result): array |
|
213 | |||
214 | /** |
||
215 | * @param ContextInterface $context |
||
216 | * @param mixed $errorValue |
||
217 | * @param int $errorCode |
||
218 | * @param string $messageTemplate |
||
219 | * @param array $messageParams |
||
220 | * |
||
221 | * @return array |
||
222 | * |
||
223 | * @SuppressWarnings(PHPMD.StaticAccess) |
||
224 | */ |
||
225 | 12 | protected static function createErrorReply( |
|
234 | } |
||
235 |