| @@ -5,9 +5,9 @@ | ||
| 5 | 5 | use Elementor\Data\V2\Base\Exceptions\Error_500; |
| 6 | 6 | use WP_REST_Server; |
| 7 | 7 | |
| 8 | 8 | if ( ! defined( 'ABSPATH' ) ) { |
| 9 | - exit; // Exit if accessed directly. | |
| 9 | + exit; // Exit if accessed directly | |
| 10 | 10 | } |
| 11 | 11 | |
| 12 | 12 | /** |
| 13 | 13 | * Class purpose is to separate routing logic into one file. |
| @@ -118,9 +118,9 @@ | ||
| 118 | 118 | |
| 119 | 119 | /** |
| 120 | 120 | * Retrieves one item from the collection. |
| 121 | 121 | * |
| 122 | - * @param string $id | |
| 122 | + * @param string $id | |
| 123 | 123 | * @param \WP_REST_Request $request Full data about the request. |
| 124 | 124 | * |
| 125 | 125 | * @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure. |
| 126 | 126 | */ |
| @@ -141,9 +141,9 @@ | ||
| 141 | 141 | |
| 142 | 142 | /** |
| 143 | 143 | * Creates one item. |
| 144 | 144 | * |
| 145 | - * @param string $id id of request item. | |
| 145 | + * @param string $id id of request item. | |
| 146 | 146 | * @param \WP_REST_Request $request Full data about the request. |
| 147 | 147 | * |
| 148 | 148 | * @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure. |
| 149 | 149 | */ |
| @@ -164,9 +164,9 @@ | ||
| 164 | 164 | |
| 165 | 165 | /** |
| 166 | 166 | * Updates one item. |
| 167 | 167 | * |
| 168 | - * @param string $id id of request item. | |
| 168 | + * @param string $id id of request item. | |
| 169 | 169 | * @param \WP_REST_Request $request Full data about the request. |
| 170 | 170 | * |
| 171 | 171 | * @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure. |
| 172 | 172 | */ |
| @@ -187,9 +187,9 @@ | ||
| 187 | 187 | |
| 188 | 188 | /** |
| 189 | 189 | * Delete one item. |
| 190 | 190 | * |
| 191 | - * @param string $id id of request item. | |
| 191 | + * @param string $id id of request item. | |
| 192 | 192 | * @param \WP_REST_Request $request Full data about the request. |
| 193 | 193 | * |
| 194 | 194 | * @return \WP_Error|\WP_REST_Response Response object on success, or WP_Error object on failure. |
| 195 | 195 | */ |
| @@ -248,9 +248,9 @@ | ||
| 248 | 248 | /** |
| 249 | 249 | * Register items route. |
| 250 | 250 | * |
| 251 | 251 | * @param string $methods |
| 252 | - * @param array $args | |
| 252 | + * @param array $args | |
| 253 | 253 | */ |
| 254 | 254 | public function register_items_route( $methods = WP_REST_Server::READABLE, $args = [] ) { |
| 255 | 255 | $args['is_multi'] = true; |
| 256 | 256 | |
| @@ -256,8 +256,15 @@ | ||
| 256 | 256 | |
| 257 | 257 | $this->register_route( '', $methods, $args ); |
| 258 | 258 | } |
| 259 | 259 | |
| 260 | + /** | |
| 261 | + * Register item route. | |
| 262 | + * | |
| 263 | + * @param string $route | |
| 264 | + * @param array $args | |
| 265 | + * @param string $methods | |
| 266 | + */ | |
| 260 | 267 | public function register_item_route( $methods = WP_REST_Server::READABLE, $args = [], $route = '/' ) { |
| 261 | 268 | if ( ! empty( $args['id_arg_name'] ) ) { |
| 262 | 269 | $this->id_arg_name = $args['id_arg_name']; |
| 263 | 270 | |
| @@ -291,12 +298,12 @@ | ||
| 291 | 298 | /** |
| 292 | 299 | * Base callback. |
| 293 | 300 | * All reset requests from the client should pass this function. |
| 294 | 301 | * |
| 295 | - * @param string $methods | |
| 302 | + * @param string $methods | |
| 296 | 303 | * @param \WP_REST_Request $request |
| 297 | - * @param bool $is_multi | |
| 298 | - * @param array $args | |
| 304 | + * @param bool $is_multi | |
| 305 | + * @param array $args | |
| 299 | 306 | * |
| 300 | 307 | * @return mixed|\WP_Error|\WP_HTTP_Response|\WP_REST_Response |
| 301 | 308 | */ |
| 302 | 309 | public function base_callback( $methods, $request, $is_multi = false, $args = [] ) { |
| @@ -358,12 +365,12 @@ | ||
| 358 | 365 | |
| 359 | 366 | /** |
| 360 | 367 | * Constructor. |
| 361 | 368 | * |
| 362 | - * Run `$this->register()`. | |
| 369 | + * run `$this->register()`. | |
| 363 | 370 | * |
| 364 | 371 | * @param \Elementor\Data\V2\Base\Controller $controller |
| 365 | - * @param string $route | |
| 372 | + * @param string $route | |
| 366 | 373 | */ |
| 367 | 374 | protected function __construct( Controller $controller, $route ) { |
| 368 | 375 | $this->controller = $controller; |
| 369 | 376 | $this->route = $this->ensure_slashes( $route ); |