| 1 |
<?php |
| 2 |
/** |
| 3 |
* An abstract route for all other routes to extend. |
| 4 |
* |
| 5 |
* @since 0.1.0 |
| 6 |
* |
| 7 |
* @package SolidWP\Performance |
| 8 |
*/ |
| 9 |
|
| 10 |
namespace SolidWP\Performance\API; |
| 11 |
|
| 12 |
use WP_REST_Request; |
| 13 |
|
| 14 |
if ( ! defined( 'ABSPATH' ) ) { |
| 15 |
exit; |
| 16 |
} |
| 17 |
|
| 18 |
/** |
| 19 |
* The class that handles the clear cache route. |
| 20 |
* |
| 21 |
* @since 0.1.0 |
| 22 |
* |
| 23 |
* @package SolidWP|Performance |
| 24 |
*/ |
| 25 |
abstract class Base_Route implements Route { |
| 26 |
|
| 27 |
/** |
| 28 |
* {@inheritdoc} |
| 29 |
*/ |
| 30 |
abstract public function get_path(): string; |
| 31 |
|
| 32 |
/** |
| 33 |
* {@inheritdoc} |
| 34 |
*/ |
| 35 |
abstract public function get_methods(); |
| 36 |
|
| 37 |
/** |
| 38 |
* {@inheritdoc} |
| 39 |
*/ |
| 40 |
abstract public function callback( WP_REST_Request $request ); |
| 41 |
|
| 42 |
/** |
| 43 |
* [@inheritdoc] |
| 44 |
*/ |
| 45 |
abstract public function schema_callback(): array; |
| 46 |
|
| 47 |
/** |
| 48 |
* {@inheritdoc} |
| 49 |
*/ |
| 50 |
public function get_arguments(): array { |
| 51 |
return []; |
| 52 |
} |
| 53 |
|
| 54 |
/** |
| 55 |
* {@inheritdoc} |
| 56 |
*/ |
| 57 |
public function permission_callback(): bool { |
| 58 |
return current_user_can( 'manage_options' ); |
| 59 |
} |
| 60 |
} |
| 61 |
|