@@ -7,9 +7,9 @@ discard block |
||
7 | 7 | |
8 | 8 | namespace WooCommerce; |
9 | 9 | |
10 | -defined( 'ABSPATH' ) || exit; |
|
10 | +defined('ABSPATH') || exit; |
|
11 | 11 | |
12 | -if ( file_exists( __DIR__ . '/../vendor/autoload.php' ) ) { |
|
12 | +if (file_exists(__DIR__ . '/../vendor/autoload.php')) { |
|
13 | 13 | require __DIR__ . '/../vendor/autoload.php'; |
14 | 14 | } else { |
15 | 15 | return; |
@@ -34,19 +34,19 @@ discard block |
||
34 | 34 | * Hook into WordPress ready to init the REST API as needed. |
35 | 35 | */ |
36 | 36 | public function init() { |
37 | - add_action( 'rest_api_init', array( $this, 'register_rest_routes' ), 10 ); |
|
37 | + add_action('rest_api_init', array($this, 'register_rest_routes'), 10); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Register REST API routes. |
42 | 42 | */ |
43 | 43 | public function register_rest_routes() { |
44 | - foreach ( $this->get_rest_namespaces() as $namespace => $namespace_class ) { |
|
44 | + foreach ($this->get_rest_namespaces() as $namespace => $namespace_class) { |
|
45 | 45 | $controllers = $namespace_class::get_controllers(); |
46 | 46 | |
47 | - foreach ( $controllers as $controller_name => $controller_class ) { |
|
48 | - $this->endpoints[ $namespace ][ $controller_name ] = new $controller_class(); |
|
49 | - $this->endpoints[ $namespace ][ $controller_name ]->register_routes(); |
|
47 | + foreach ($controllers as $controller_name => $controller_class) { |
|
48 | + $this->endpoints[$namespace][$controller_name] = new $controller_class(); |
|
49 | + $this->endpoints[$namespace][$controller_name]->register_routes(); |
|
50 | 50 | } |
51 | 51 | } |
52 | 52 | } |
@@ -73,17 +73,17 @@ discard block |
||
73 | 73 | * @param array $params Params to passwith request. |
74 | 74 | * @return array|WP_Error |
75 | 75 | */ |
76 | - public function get_endpoint_data( $endpoint, $params = array() ) { |
|
77 | - $request = new \WP_REST_Request( 'GET', $endpoint ); |
|
76 | + public function get_endpoint_data($endpoint, $params = array()) { |
|
77 | + $request = new \WP_REST_Request('GET', $endpoint); |
|
78 | 78 | |
79 | - if ( $params ) { |
|
80 | - $request->set_query_params( $params ); |
|
79 | + if ($params) { |
|
80 | + $request->set_query_params($params); |
|
81 | 81 | } |
82 | 82 | |
83 | - $response = \rest_do_request( $request ); |
|
83 | + $response = \rest_do_request($request); |
|
84 | 84 | $server = \rest_get_server(); |
85 | - $json = wp_json_encode( $server->response_to_data( $response, false ) ); |
|
85 | + $json = wp_json_encode($server->response_to_data($response, false)); |
|
86 | 86 | |
87 | - return json_decode( $json, true ); |
|
87 | + return json_decode($json, true); |
|
88 | 88 | } |
89 | 89 | } |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @package WooCommerce/RestApi |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Controllers class. |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @package WooCommerce/RestApi |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Controllers class. |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @since 2.6.0 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * REST API Taxes controller class. |
@@ -5,7 +5,7 @@ |
||
5 | 5 | * @package WooCommerce/RestApi |
6 | 6 | */ |
7 | 7 | |
8 | -defined( 'ABSPATH' ) || exit; |
|
8 | +defined('ABSPATH') || exit; |
|
9 | 9 | |
10 | 10 | /** |
11 | 11 | * Controllers class. |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @since 2.6.0 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * REST API Report Sales controller class. |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @since 2.6.0 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * REST API Product Shipping Classes controller class. |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @since 2.6.0 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * REST API Product Attribute Terms controller class. |
@@ -8,7 +8,7 @@ |
||
8 | 8 | * @since 2.6.0 |
9 | 9 | */ |
10 | 10 | |
11 | -defined( 'ABSPATH' ) || exit; |
|
11 | +defined('ABSPATH') || exit; |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * REST API Report Top Sellers controller class. |