Conditions | 3 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 3.0123 |
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 | 1 | catch( Exception $e ) { |
|
41 | 1 | status_header( 400 ); |
|
42 | 1 | glsr( Notice::class )->addError( new WP_Error( 'site_reviews_error', $e->getMessage() )); |
|
43 | 1 | glsr_log()->error( $e->getMessage() ); |
|
44 | } |
||
55 |