PluginProbe
Polylang / 3.7.7
Polylang v3.7.7
3.8.9 3.8.8 3.8.7 3.8.6 3.8.5 3.8.4 3.8.3 2.7 2.7.0.1 2.7.1 2.7.2 2.7.3 2.7.4 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.9 2.9.1 2.9.2 3.0 3.0.1 3.0.2 3.0.3 All 233 releases
polylang / modules / REST / Abstract_Controller.php

Abstract_Controller.php in Polylang 3.7.7, at modules/REST/Abstract_Controller.php

33 lines 681 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Polylang
4 */
5
6 namespace WP_Syntex\Polylang\REST;
7
8 use WP_Error;
9 use WP_REST_Controller;
10
11 defined( 'ABSPATH' ) || exit;
12
13 /**
14 * Abstract REST controller.
15 *
16 * @since 3.7
17 */
18 abstract class Abstract_Controller extends WP_REST_Controller {
19 /**
20 * Adds a status code to the given error and returns the error.
21 *
22 * @since 3.7
23 *
24 * @param WP_Error $error A `WP_Error` object.
25 * @param int $status_code Optional. A status code. Default is 400.
26 * @return WP_Error
27 */
28 protected function add_status_to_error( WP_Error $error, int $status_code = 400 ): WP_Error {
29 $error->add_data( array( 'status' => $status_code ) );
30 return $error;
31 }
32 }
33