Code Duplication    Length = 11-13 lines in 3 locations

modules/monitor.php 3 locations

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