Code Duplication    Length = 11-13 lines in 4 locations

modules/monitor.php 3 locations

@@ 85-95 (lines=11) @@
82
		<?php
83
	}
84
85
	public function is_active() {
86
		Jetpack::load_xml_rpc_client();
87
		$xml = new Jetpack_IXR_Client( array(
88
			'user_id' => get_current_user_id()
89
		) );
90
		$xml->query( 'jetpack.monitor.isActive' );
91
		if ( $xml->isError() ) {
92
			wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) );
93
		}
94
		return $xml->getResponse();
95
	}
96
97
	public function update_option_receive_jetpack_monitor_notification( $value ) {
98
		Jetpack::load_xml_rpc_client();
@@ 141-153 (lines=13) @@
138
		return $xml->getResponse();
139
	}
140
141
	public function activate_monitor() {
142
		Jetpack::load_xml_rpc_client();
143
		$xml = new Jetpack_IXR_Client( array(
144
			'user_id' => get_current_user_id()
145
		) );
146
147
		$xml->query( 'jetpack.monitor.activate' );
148
149
		if ( $xml->isError() ) {
150
			wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) );
151
		}
152
		return true;
153
	}
154
155
	public function deactivate_monitor() {
156
		Jetpack::load_xml_rpc_client();
@@ 155-167 (lines=13) @@
152
		return true;
153
	}
154
155
	public function deactivate_monitor() {
156
		Jetpack::load_xml_rpc_client();
157
		$xml = new Jetpack_IXR_Client( array(
158
			'user_id' => get_current_user_id()
159
		) );
160
161
		$xml->query( 'jetpack.monitor.deactivate' );
162
163
		if ( $xml->isError() ) {
164
			wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) );
165
		}
166
		return true;
167
	}
168
169
	/*
170
	 * Returns date of the last downtime.

modules/sso.php 1 location

@@ 572-584 (lines=13) @@
569
		return $xml->getResponse();
570
	}
571
572
	static function request_initial_nonce() {
573
		Jetpack::load_xml_rpc_client();
574
		$xml = new Jetpack_IXR_Client( array(
575
			'user_id' => get_current_user_id(),
576
		) );
577
		$xml->query( 'jetpack.sso.requestNonce' );
578
579
		if ( $xml->isError() ) {
580
			return new WP_Error( $xml->getErrorCode(), $xml->getErrorMessage() );
581
		}
582
583
		return $xml->getResponse();
584
	}
585
586
	/**
587
	 * The function that actually handles the login!