Code Duplication    Length = 11-13 lines in 3 locations

modules/monitor.php 3 locations

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