| @@ 136-144 (lines=9) @@ | ||
| 133 | ||
| 134 | public function filter($v) |
|
| 135 | { |
|
| 136 | foreach($this->components as $component) |
|
| 137 | { |
|
| 138 | if($component instanceof FilterableComponentInterface && |
|
| 139 | \is_callable($component->filter)) |
|
| 140 | { |
|
| 141 | $n = $component->name; |
|
| 142 | $v[$n] = $component->filter($v[$n]); |
|
| 143 | } |
|
| 144 | } |
|
| 145 | ||
| 146 | return $v; |
|
| 147 | } |
|
| @@ 151-162 (lines=12) @@ | ||
| 148 | ||
| 149 | public function validation($v,&$e) |
|
| 150 | { |
|
| 151 | foreach($this->components as $component) |
|
| 152 | { |
|
| 153 | if($component instanceof ValidatableComponentInterface && |
|
| 154 | \is_callable($component->validation)) |
|
| 155 | { |
|
| 156 | $n = $component->name; |
|
| 157 | if(!$component->validation($v[$n],$e)) |
|
| 158 | { |
|
| 159 | return false; |
|
| 160 | } |
|
| 161 | } |
|
| 162 | } |
|
| 163 | return true; |
|
| 164 | } |
|
| 165 | ||