| Conditions | 3 |
| Paths | 3 |
| Total Lines | 12 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 4 |
| CRAP Score | 4.5435 |
| Changes | 0 | ||
| 1 | <?php |
||
| 33 | 1 | public function execute($command) |
|
| 34 | { |
||
| 35 | 1 | $handlerClass = str_replace('Commands', 'Handlers', get_class($command)); |
|
| 36 | 1 | if (!class_exists($handlerClass)) { |
|
| 37 | throw new InvalidArgumentException('Handler '.$handlerClass.' not found.'); |
||
| 38 | } |
||
| 39 | try { |
||
| 40 | 1 | return glsr($handlerClass)->handle($command); |
|
| 41 | } catch (Exception $e) { |
||
| 42 | status_header(400); |
||
| 43 | glsr(Notice::class)->addError(new WP_Error('site_reviews_error', $e->getMessage())); |
||
| 44 | glsr_log()->error($e->getMessage()); |
||
| 45 | } |
||
| 65 |