Completed
Push — master ( 411054...889b36 )
by Mike
557:22 queued 512:23
created
src/RestApi/Version4/Controllers/ProductTags.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@  discard block
 block discarded – undo
9 9
 
10 10
 namespace WooCommerce\RestApi\Version4\Controllers;
11 11
 
12
-defined( 'ABSPATH' ) || exit;
12
+defined('ABSPATH') || exit;
13 13
 
14 14
 /**
15 15
  * REST API Product Tags controller class.
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 	 * @param \WP_REST_Request $request Request params.
38 38
 	 * @return \WP_REST_Response $response
39 39
 	 */
40
-	public function prepare_item_for_response( $item, $request ) {
40
+	public function prepare_item_for_response($item, $request) {
41 41
 		$data = array(
42 42
 			'id'          => (int) $item->term_id,
43 43
 			'name'        => $item->name,
@@ -46,13 +46,13 @@  discard block
 block discarded – undo
46 46
 			'count'       => (int) $item->count,
47 47
 		);
48 48
 
49
-		$context = ! empty( $request['context'] ) ? $request['context'] : 'view';
50
-		$data    = $this->add_additional_fields_to_object( $data, $request );
51
-		$data    = $this->filter_response_by_context( $data, $context );
49
+		$context = ! empty($request['context']) ? $request['context'] : 'view';
50
+		$data    = $this->add_additional_fields_to_object($data, $request);
51
+		$data    = $this->filter_response_by_context($data, $context);
52 52
 
53
-		$response = rest_ensure_response( $data );
53
+		$response = rest_ensure_response($data);
54 54
 
55
-		$response->add_links( $this->prepare_links( $item, $request ) );
55
+		$response->add_links($this->prepare_links($item, $request));
56 56
 
57 57
 		/**
58 58
 		 * Filter a term item returned from the API.
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
 		 * @param object            $item      The original term object.
64 64
 		 * @param \WP_REST_Request   $request   Request used to generate the response.
65 65
 		 */
66
-		return apply_filters( "woocommerce_rest_prepare_{$this->taxonomy}", $response, $item, $request );
66
+		return apply_filters("woocommerce_rest_prepare_{$this->taxonomy}", $response, $item, $request);
67 67
 	}
68 68
 
69 69
 	/**
@@ -78,44 +78,44 @@  discard block
 block discarded – undo
78 78
 			'type'                 => 'object',
79 79
 			'properties'           => array(
80 80
 				'id' => array(
81
-					'description' => __( 'Unique identifier for the resource.', 'woocommerce' ),
81
+					'description' => __('Unique identifier for the resource.', 'woocommerce'),
82 82
 					'type'        => 'integer',
83
-					'context'     => array( 'view', 'edit' ),
83
+					'context'     => array('view', 'edit'),
84 84
 					'readonly'    => true,
85 85
 				),
86 86
 				'name' => array(
87
-					'description' => __( 'Tag name.', 'woocommerce' ),
87
+					'description' => __('Tag name.', 'woocommerce'),
88 88
 					'type'        => 'string',
89
-					'context'     => array( 'view', 'edit' ),
89
+					'context'     => array('view', 'edit'),
90 90
 					'arg_options' => array(
91 91
 						'sanitize_callback' => 'sanitize_text_field',
92 92
 					),
93 93
 				),
94 94
 				'slug' => array(
95
-					'description' => __( 'An alphanumeric identifier for the resource unique to its type.', 'woocommerce' ),
95
+					'description' => __('An alphanumeric identifier for the resource unique to its type.', 'woocommerce'),
96 96
 					'type'        => 'string',
97
-					'context'     => array( 'view', 'edit' ),
97
+					'context'     => array('view', 'edit'),
98 98
 					'arg_options' => array(
99 99
 						'sanitize_callback' => 'sanitize_title',
100 100
 					),
101 101
 				),
102 102
 				'description' => array(
103
-					'description' => __( 'HTML description of the resource.', 'woocommerce' ),
103
+					'description' => __('HTML description of the resource.', 'woocommerce'),
104 104
 					'type'        => 'string',
105
-					'context'     => array( 'view', 'edit' ),
105
+					'context'     => array('view', 'edit'),
106 106
 					'arg_options' => array(
107 107
 						'sanitize_callback' => 'wp_filter_post_kses',
108 108
 					),
109 109
 				),
110 110
 				'count' => array(
111
-					'description' => __( 'Number of published products for the resource.', 'woocommerce' ),
111
+					'description' => __('Number of published products for the resource.', 'woocommerce'),
112 112
 					'type'        => 'integer',
113
-					'context'     => array( 'view', 'edit' ),
113
+					'context'     => array('view', 'edit'),
114 114
 					'readonly'    => true,
115 115
 				),
116 116
 			),
117 117
 		);
118 118
 
119
-		return $this->add_additional_fields_schema( $schema );
119
+		return $this->add_additional_fields_schema($schema);
120 120
 	}
121 121
 }
Please login to merge, or discard this patch.
src/Utilities/SingletonTrait.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -33,7 +33,7 @@
 block discarded – undo
33 33
 	 * @return object Instance.
34 34
 	 */
35 35
 	final public static function instance() {
36
-		if ( null === static::$instance ) {
36
+		if (null === static::$instance) {
37 37
 			static::$instance = new static();
38 38
 		}
39 39
 		return static::$instance;
Please login to merge, or discard this patch.
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.