Code Duplication    Length = 11-13 lines in 3 locations

modules/monitor.php 3 locations

@@ 35-45 (lines=11) @@
32
		Jetpack::enable_module_configurable( $this->module );
33
	}
34
35
	public function is_active() {
36
		Jetpack::load_xml_rpc_client();
37
		$xml = new Jetpack_IXR_Client( array(
38
			'user_id' => get_current_user_id()
39
		) );
40
		$xml->query( 'jetpack.monitor.isActive' );
41
		if ( $xml->isError() ) {
42
			wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) );
43
		}
44
		return $xml->getResponse();
45
	}
46
47
	public function update_option_receive_jetpack_monitor_notification( $value ) {
48
		Jetpack::load_xml_rpc_client();
@@ 91-103 (lines=13) @@
88
		return $xml->getResponse();
89
	}
90
91
	public function activate_monitor() {
92
		Jetpack::load_xml_rpc_client();
93
		$xml = new Jetpack_IXR_Client( array(
94
			'user_id' => get_current_user_id()
95
		) );
96
97
		$xml->query( 'jetpack.monitor.activate' );
98
99
		if ( $xml->isError() ) {
100
			wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) );
101
		}
102
		return true;
103
	}
104
105
	public function deactivate_monitor() {
106
		Jetpack::load_xml_rpc_client();
@@ 105-117 (lines=13) @@
102
		return true;
103
	}
104
105
	public function deactivate_monitor() {
106
		Jetpack::load_xml_rpc_client();
107
		$xml = new Jetpack_IXR_Client( array(
108
			'user_id' => get_current_user_id()
109
		) );
110
111
		$xml->query( 'jetpack.monitor.deactivate' );
112
113
		if ( $xml->isError() ) {
114
			wp_die( sprintf( '%s: %s', $xml->getErrorCode(), $xml->getErrorMessage() ) );
115
		}
116
		return true;
117
	}
118
119
	/*
120
	 * Returns date of the last downtime.