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