Code Duplication    Length = 6-8 lines in 2 locations

class.jetpack-client.php 1 location

@@ 65-72 (lines=8) @@
62
		}
63
64
		// Kind of annoying.  Maybe refactor Jetpack_Signature to handle body-hashing
65
		if ( is_null( $body ) ) {
66
			$body_hash = '';
67
		} else {
68
			if ( !is_string( $body ) ) {
69
				return new Jetpack_Error( 'invalid_body', 'Body is malformed.' );
70
			}
71
			$body_hash = jetpack_sha1_base64( $body );
72
		}
73
74
		$auth = array(
75
			'token' => $token_key,

class.jetpack-signature.php 1 location

@@ 100-105 (lines=6) @@
97
		}
98
99
		$required_parameters = array( 'token', 'timestamp', 'nonce', 'method', 'url' );
100
		if ( !is_null( $body ) ) {
101
			$required_parameters[] = 'body_hash';
102
			if ( !is_string( $body ) ) {
103
				return new Jetpack_Error( 'invalid_body', 'Body is malformed.' );
104
			}
105
		}
106
107
		foreach ( $required_parameters as $required ) {
108
			if ( !is_scalar( $$required ) ) {