1 | <?php namespace Limoncello\Validation\Captures; |
||
26 | abstract class BaseCapture implements RuleInterface |
||
27 | { |
||
28 | /** |
||
29 | * @var RuleInterface |
||
30 | */ |
||
31 | private $rule; |
||
32 | |||
33 | /** |
||
34 | * @var bool |
||
35 | */ |
||
36 | private $hadErrors = false; |
||
37 | |||
38 | /** |
||
39 | * @var CaptureAggregatorInterface |
||
40 | */ |
||
41 | private $aggregator; |
||
42 | |||
43 | /** |
||
44 | * @var string |
||
45 | */ |
||
46 | private $name; |
||
47 | |||
48 | /** |
||
49 | * @param mixed $data |
||
50 | * |
||
51 | * @return void |
||
52 | */ |
||
53 | abstract protected function capture($data); |
||
54 | |||
55 | /** |
||
56 | * @return mixed |
||
57 | */ |
||
58 | abstract protected function getCapturedData(); |
||
59 | |||
60 | /** |
||
61 | * @param string $name |
||
62 | * @param RuleInterface $rule |
||
63 | * @param CaptureAggregatorInterface $aggregator |
||
64 | */ |
||
65 | 4 | public function __construct($name, RuleInterface $rule, CaptureAggregatorInterface $aggregator) |
|
71 | |||
72 | /** |
||
73 | * @inheritdoc |
||
74 | */ |
||
75 | 4 | public function validate($input) |
|
87 | |||
88 | /** |
||
89 | * @inheritdoc |
||
90 | */ |
||
91 | 1 | public function isStateless() |
|
95 | |||
96 | /** |
||
97 | * @inheritdoc |
||
98 | */ |
||
99 | 4 | public function setParentRule(RuleInterface $parent) |
|
103 | |||
104 | /** |
||
105 | * @inheritdoc |
||
106 | */ |
||
107 | 3 | public function getParameterName() |
|
111 | |||
112 | /** |
||
113 | * @inheritdoc |
||
114 | */ |
||
115 | 3 | public function setParameterName($parameterName) |
|
121 | |||
122 | /** |
||
123 | * @inheritdoc |
||
124 | */ |
||
125 | 4 | public function onFinish(ErrorAggregatorInterface $aggregator) |
|
136 | |||
137 | /** |
||
138 | * @return CaptureAggregatorInterface |
||
139 | */ |
||
140 | 3 | protected function getAggregator() |
|
144 | |||
145 | /** |
||
146 | * @return RuleInterface |
||
147 | */ |
||
148 | 4 | protected function getRule() |
|
152 | |||
153 | /** |
||
154 | * @return string |
||
155 | */ |
||
156 | 3 | protected function getCaptureName() |
|
160 | |||
161 | /** |
||
162 | * @return boolean |
||
163 | */ |
||
164 | 4 | protected function hadErrors() |
|
168 | } |
||
169 |