Passed
Push — master ( f6ffce...df97a7 )
by Andrey
01:35
created
php/class-rest-api-handler.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -16,12 +16,12 @@  discard block
 block discarded – undo
16 16
 	 */
17 17
 	private function isRestRequest() {
18 18
 
19
-		if ( defined( 'REST_REQUEST' ) && REST_REQUEST ) {
19
+		if (defined('REST_REQUEST') && REST_REQUEST) {
20 20
 			return true;
21 21
 		}
22 22
 
23 23
 		// This is dirty, but no better way to detect before parse_request.
24
-		if ( ! empty( $_SERVER['REQUEST_URI'] ) && 0 !== stripos( $_SERVER['REQUEST_URI'], rest_get_url_prefix() ) ) {
24
+		if ( ! empty($_SERVER['REQUEST_URI']) && 0 !== stripos($_SERVER['REQUEST_URI'], rest_get_url_prefix())) {
25 25
 			return true;
26 26
 		}
27 27
 
@@ -33,25 +33,25 @@  discard block
 block discarded – undo
33 33
 	 */
34 34
 	public function handle() {
35 35
 
36
-		if ( ! $this->isRestRequest() ) {
36
+		if ( ! $this->isRestRequest()) {
37 37
 			return Handler::DONE;
38 38
 		}
39 39
 
40
-		$data     = Formatter::formatExceptionAsDataArray( $this->getInspector(), $this->addTraceToOutput() );
40
+		$data     = Formatter::formatExceptionAsDataArray($this->getInspector(), $this->addTraceToOutput());
41 41
 		$response = array(
42 42
 			'code'    => $data['type'],
43 43
 			'message' => $data['message'],
44 44
 			'data'    => $data,
45 45
 		);
46 46
 
47
-		if ( Misc::canSendHeaders() ) {
48
-			status_header( 500 );
49
-			header( 'Content-Type: application/json; charset=' . get_option( 'blog_charset' ) );
47
+		if (Misc::canSendHeaders()) {
48
+			status_header(500);
49
+			header('Content-Type: application/json; charset=' . get_option('blog_charset'));
50 50
 		}
51 51
 
52
-		$json_options = version_compare( PHP_VERSION, '5.4.0', '>=' ) ? JSON_PRETTY_PRINT : 0;
52
+		$json_options = version_compare(PHP_VERSION, '5.4.0', '>=') ? JSON_PRETTY_PRINT : 0;
53 53
 
54
-		echo wp_json_encode( $response, $json_options );
54
+		echo wp_json_encode($response, $json_options);
55 55
 
56 56
 		return Handler::QUIT;
57 57
 	}
Please login to merge, or discard this patch.