Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Regenerate_CSS | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| handle | |
0.00% |
0 / 8 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\Jetpack_Boost\Lib\Critical_CSS\Data_Sync_Actions; |
| 4 | |
| 5 | use Automattic\Jetpack\WP_JS_Data_Sync\Contracts\Data_Sync_Action; |
| 6 | use Automattic\Jetpack_Boost\Lib\Critical_CSS\Regenerate; |
| 7 | |
| 8 | /** |
| 9 | * Critical CSS Action: request regeneration. |
| 10 | */ |
| 11 | class Regenerate_CSS implements Data_Sync_Action { |
| 12 | |
| 13 | /** |
| 14 | * Handles the action logic. |
| 15 | * |
| 16 | * @param mixed $_data JSON Data passed to the action. |
| 17 | * @param \WP_REST_Request $_request The request object. |
| 18 | */ |
| 19 | public function handle( $_data, $_request ) { |
| 20 | $regenerate = new Regenerate(); |
| 21 | $regenerate->start(); |
| 22 | |
| 23 | $state = $regenerate->get_state(); |
| 24 | |
| 25 | return array( |
| 26 | 'success' => ! $state->has_errors(), |
| 27 | 'state' => $state->get(), |
| 28 | 'errors' => $state->get_error_message(), |
| 29 | ); |
| 30 | } |
| 31 | } |