Code Duplication    Length = 8-12 lines in 2 locations

class.jetpack.php 2 locations

@@ 4799-4806 (lines=8) @@
4796
		// are known to work with signature verification.  A different method
4797
		// can be passed to the WP REST API via the '?_method=' parameter if
4798
		// needed.
4799
		if ( $_SERVER['REQUEST_METHOD'] !== 'GET' && $_SERVER['REQUEST_METHOD'] !== 'POST' ) {
4800
			$this->rest_authentication_status = new WP_Error(
4801
				'rest_invalid_request',
4802
				__( 'This request method is not supported.', 'jetpack' ),
4803
				array( 'status' => 400 )
4804
			);
4805
			return null;
4806
		}
4807
		if ( $_SERVER['REQUEST_METHOD'] !== 'POST' && ! empty( $this->HTTP_RAW_POST_DATA ) ) {
4808
			$this->rest_authentication_status = new WP_Error(
4809
				'rest_invalid_request',
@@ 4815-4826 (lines=12) @@
4812
			);
4813
			return null;
4814
		}
4815
		if (
4816
			isset( $_SERVER['CONTENT_TYPE'] ) &&
4817
			$_SERVER['CONTENT_TYPE'] !== 'application/x-www-form-urlencoded' &&
4818
			$_SERVER['CONTENT_TYPE'] !== 'application/json'
4819
		) {
4820
			$this->rest_authentication_status = new WP_Error(
4821
				'rest_invalid_request',
4822
				__( 'This Content-Type is not supported.', 'jetpack' ),
4823
				array( 'status' => 400 )
4824
			);
4825
			return null;
4826
		}
4827
4828
		$verified = $this->verify_xml_rpc_signature();
4829