PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 1.2.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v1.2.0
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / API / Route.php

Route.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 1.2.0, at src/Performance/API/Route.php

84 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The contract defining required methods for a REST route.
4 *
5 * @since 0.1.0
6 *
7 * @package SolidWP\Performance
8 */
9
10 namespace SolidWP\Performance\API;
11
12 use WP_Error;
13 use WP_REST_Request;
14 use WP_REST_Response;
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20 /**
21 * The contract defining required methods for a REST route.
22 *
23 * @since 0.1.0
24 *
25 * @package SolidWP\Performance
26 */
27 interface Route {
28 /**
29 * Get the path pattern of the REST API endpoint (e.g. '/author/(?P<id>\d+)').
30 *
31 * @since 0.1.0
32 *
33 * @return string
34 */
35 public function get_path(): string;
36
37 /**
38 * Gets the HTTP methods that the REST API endpoint responds to.
39 *
40 * @since 0.1.0
41 *
42 * @return mixed
43 */
44 public function get_methods();
45
46 /**
47 * The action performed by the REST API endpoint to send a response.
48 *
49 * @since 0.1.0
50 *
51 * @param WP_REST_Request $request The current request for the route.
52 *
53 * @return WP_REST_Response|WP_Error
54 */
55 public function callback( WP_REST_Request $request );
56
57 /**
58 * Gets the expected arguments for the REST API endpoint.
59 *
60 * @since 0.1.0
61 *
62 * @return array
63 */
64 public function get_arguments(): array;
65
66 /**
67 * Ensures user can make a request to the REST API endpoint.
68 *
69 * @since 0.1.0
70 *
71 * @return bool
72 */
73 public function permission_callback(): bool;
74
75 /**
76 * The callback used to output schema for the route.
77 *
78 * @since 0.1.0
79 *
80 * @return array
81 */
82 public function schema_callback(): array;
83 }
84