1 | <?php namespace Limoncello\Validation\Rules; |
||
26 | abstract class BaseRule implements RuleInterface |
||
27 | { |
||
28 | /** |
||
29 | * State key. |
||
30 | */ |
||
31 | const STATE_ERROR_VALUE = 0; |
||
32 | |||
33 | /** |
||
34 | * State key. |
||
35 | */ |
||
36 | const STATE_LAST = self::STATE_ERROR_VALUE; |
||
37 | |||
38 | /** |
||
39 | * Property key. |
||
40 | */ |
||
41 | const PROPERTY_NAME = 0; |
||
42 | |||
43 | /** |
||
44 | * Property key. |
||
45 | */ |
||
46 | const PROPERTY_IS_CAPTURE_ENABLED = self::PROPERTY_NAME + 1; |
||
47 | |||
48 | /** |
||
49 | * Property key. |
||
50 | */ |
||
51 | const PROPERTY_LAST = self::PROPERTY_IS_CAPTURE_ENABLED; |
||
52 | |||
53 | /** |
||
54 | * @var string|null |
||
55 | */ |
||
56 | private $name = null; |
||
57 | |||
58 | /** |
||
59 | * @var bool |
||
60 | */ |
||
61 | private $isCaptureEnabled = false; |
||
62 | |||
63 | /** |
||
64 | * @var RuleInterface|null |
||
65 | */ |
||
66 | private $parent = null; |
||
67 | |||
68 | /** |
||
69 | * @inheritdoc |
||
70 | */ |
||
71 | 26 | public function getName(): string |
|
79 | |||
80 | /** |
||
81 | * @inheritdoc |
||
82 | */ |
||
83 | 21 | public function setName(string $name): RuleInterface |
|
89 | |||
90 | /** |
||
91 | * @inheritdoc |
||
92 | */ |
||
93 | 1 | public function unsetName(): RuleInterface |
|
99 | |||
100 | /** |
||
101 | * @inheritdoc |
||
102 | */ |
||
103 | 22 | public function enableCapture(): RuleInterface |
|
109 | |||
110 | /** |
||
111 | * @inheritdoc |
||
112 | */ |
||
113 | 1 | public function disableCapture(): RuleInterface |
|
119 | |||
120 | /** |
||
121 | * @inheritdoc |
||
122 | */ |
||
123 | 26 | public function isCaptureEnabled(): bool |
|
127 | |||
128 | /** |
||
129 | * @inheritdoc |
||
130 | */ |
||
131 | 15 | public function getParent(): ?RuleInterface |
|
135 | |||
136 | /** |
||
137 | * @inheritdoc |
||
138 | */ |
||
139 | 15 | public function setParent(RuleInterface $rule): RuleInterface |
|
145 | |||
146 | /** |
||
147 | * @inheritdoc |
||
148 | */ |
||
149 | 1 | public function unsetParent(): RuleInterface |
|
155 | |||
156 | /** |
||
157 | * @return array |
||
158 | */ |
||
159 | 25 | protected function getStandardProperties(): array |
|
163 | |||
164 | /** |
||
165 | * @param string $name |
||
166 | * @param bool $isCaptureEnabled |
||
167 | * |
||
168 | * @return array |
||
169 | */ |
||
170 | 25 | protected function composeStandardProperties(string $name, bool $isCaptureEnabled): array |
|
177 | } |
||
178 |