| Conditions | 3 |
| Paths | 3 |
| Total Lines | 15 |
| Code Lines | 11 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 7 |
| CRAP Score | 3.6511 |
| Changes | 3 | ||
| Bugs | 1 | Features | 0 |
| 1 | <?php |
||
| 15 | 1 | public function handle(Command $command) |
|
| 16 | { |
||
| 17 | 1 | $review = glsr(ReviewManager::class)->create($command); |
|
| 18 | 1 | if (!$review) { |
|
| 19 | glsr(Session::class)->set($command->form_id.'errors', []); |
||
| 20 | glsr(Session::class)->set($command->form_id.'message', __('Your review could not be submitted and the error has been logged. Please notify the site admin.', 'site-reviews')); |
||
| 21 | return; |
||
| 22 | } |
||
| 23 | 1 | glsr(Session::class)->set($command->form_id.'message', __('Your review has been submitted!', 'site-reviews')); |
|
| 24 | 1 | glsr(Notification::class)->send($review); |
|
| 25 | 1 | if ($command->ajax_request) { |
|
| 26 | 1 | return; |
|
| 27 | } |
||
| 28 | wp_safe_redirect($this->getReferer($command)); |
||
| 29 | exit; |
||
| 30 | } |
||
| 49 |