| Conditions | 5 |
| Paths | 5 |
| Total Lines | 18 |
| Code Lines | 6 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 24 | public function handle(callable $callback, bool $popup = false) { |
||
| 25 | |||
| 26 | if (false === ($post = $this->post())) return false; |
||
| 27 | |||
| 28 | # Check form for errors |
||
| 29 | |||
| 30 | if ($this->errors()) return $this->displayError('FORM_ERROR_REQUIRED', $popup); |
||
| 31 | |||
| 32 | # Call controller method |
||
| 33 | |||
| 34 | if (is_string($result = $callback($post))) return $this->displayError($result, $popup); |
||
| 35 | |||
| 36 | if (is_array($result)) { $this->get($result[0])->error(true); return $this->displayError($result[1], $popup); } |
||
| 37 | |||
| 38 | # ------------------------ |
||
| 39 | |||
| 40 | return (true === $result); |
||
| 41 | } |
||
| 42 | } |
||
| 44 |