Test Failed
Push — master ( 44764d...6dc399 )
by Mike
04:21
created
src/RestApi.php 1 patch
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -7,9 +7,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 }
Please login to merge, or discard this patch.
src/RestApi/Version1/class-wc-rest-controllers-v1.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
src/RestApi/Blocks/Version1/class-wc-rest-blocks-controllers.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
src/RestApi/Version2/class-wc-rest-taxes-v2-controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
src/RestApi/Version2/class-wc-rest-controllers-v2.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -5,7 +5,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
src/RestApi/Version2/class-wc-rest-report-sales-v2-controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
RestApi/Version2/class-wc-rest-product-shipping-classes-v2-controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
RestApi/Version2/class-wc-rest-product-attribute-terms-v2-controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.
src/RestApi/Version2/class-wc-rest-report-top-sellers-v2-controller.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
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.
Please login to merge, or discard this patch.