Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | namespace Automattic\Jetpack_Boost\REST_API\Contracts; |
| 4 | |
| 5 | /** |
| 6 | * API Endpoints have permissions that are checked by WordPress on `permission_callback`. |
| 7 | * |
| 8 | * These permissions repeat themselves, for example: |
| 9 | * * current_user_can |
| 10 | * * wp_verify_nonce |
| 11 | * |
| 12 | * And in the case of nonces - they also need to interact with the rest of the application. |
| 13 | * Permission contract helps make the permission callbacks more predictable. |
| 14 | * This is especially necessary to deal with nonces |
| 15 | * (or more on that, read `permissions/class-nonce.php` |
| 16 | */ |
| 17 | interface Permission { |
| 18 | /** |
| 19 | * A method to verify whether this request |
| 20 | * can be run in the current environment. |
| 21 | * |
| 22 | * @param \WP_REST_Request $request |
| 23 | * |
| 24 | * @return bool |
| 25 | */ |
| 26 | public function verify( $request ); |
| 27 | } |