Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 4 |
CRAP | |
0.00% |
0 / 1 |
| Clear | |
0.00% |
0 / 8 |
|
0.00% |
0 / 4 |
30 | |
0.00% |
0 / 1 |
| name | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| request_methods | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| response | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
6 | |||
| permissions | |
0.00% |
0 / 3 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Create a new request for cloud critical CSS. |
| 4 | * |
| 5 | * Handler for POST 'cloud-css/request-generate'. |
| 6 | */ |
| 7 | namespace Automattic\Jetpack_Inspect\REST_API\Endpoints; |
| 8 | |
| 9 | use Automattic\Jetpack_Inspect\Log; |
| 10 | use Automattic\Jetpack_Inspect\REST_API\Contracts\Endpoint; |
| 11 | use Automattic\Jetpack_Inspect\REST_API\Permissions\Current_User_Admin; |
| 12 | |
| 13 | class Clear implements Endpoint { |
| 14 | |
| 15 | public function name() { |
| 16 | return 'clear'; |
| 17 | } |
| 18 | |
| 19 | public function request_methods() { |
| 20 | return \WP_REST_Server::DELETABLE; |
| 21 | } |
| 22 | |
| 23 | //phpcs:disable VariableAnalysis.CodeAnalysis.VariableAnalysis.UnusedVariable |
| 24 | public function response( $request ) { |
| 25 | return rest_ensure_response( |
| 26 | Log::clear() ? 'OK' : '' |
| 27 | ); |
| 28 | } |
| 29 | |
| 30 | public function permissions() { |
| 31 | return array( |
| 32 | new Current_User_Admin(), |
| 33 | ); |
| 34 | } |
| 35 | } |