Code Duplication    Length = 5-7 lines in 3 locations

modules/monitor.php 1 location

@@ 93-99 (lines=7) @@
90
		) );
91
		$xml->query( 'jetpack.monitor.isUserInNotifications' );
92
93
		if ( $xml->isError() ) {
94
			if ( $die_on_error ) {
95
				wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) );
96
			} else {
97
				return new WP_Error( $xml->getErrorCode(), $xml->getErrorMessage(), array( 'status' => 400 ) );
98
			}
99
		}
100
		return $xml->getResponse();
101
	}
102

_inc/lib/class.core-rest-api-endpoints.php 1 location

@@ 890-894 (lines=5) @@
887
888
		$xml->query( 'jetpack.isSiteVerified', $args );
889
890
		if ( $xml->isError() ) {
891
			return new WP_Error( 'error_checking_if_site_verified_google', sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) );
892
		} else {
893
			return $xml->getResponse();
894
		}
895
	}
896
897

packages/licensing/src/class-licensing.php 1 location

@@ 151-155 (lines=5) @@
148
149
		$xml = $this->attach_licenses_request( $licenses );
150
151
		if ( $xml->isError() ) {
152
			$error = new WP_Error( 'request_failed', __( 'License attach request failed.', 'jetpack' ) );
153
			$error->add( $xml->getErrorCode(), $xml->getErrorMessage() );
154
			return $error;
155
		}
156
157
		$results = array_map(
158
			function ( $response ) {