Completed
Push — update/admin-menu-sync-wpcom ( b0ac91...43248e )
by
unknown
124:17 queued 113:08
created

Jetpack_Connection_Status::init()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
/**
3
 * Jetpack Connection Status.
4
 *
5
 * Filters the Connection Status API response
6
 *
7
 * @package jetpack
8
 */
9
10
/**
11
 * Filters the Connection Status API response
12
 */
13
class Jetpack_Connection_Status {
14
15
	/**
16
	 * Initialize the main hooks.
17
	 */
18
	public static function init() {
19
		add_filter( 'jetpack_connection_status', array( __CLASS__, 'filter_connection_status' ) );
20
	}
21
22
	/**
23
	 * Filters the connection status API response of the Connection package and modifies isActive value expected by the UI.
24
	 *
25
	 * @param array $status An array containing the connection status data.
26
	 */
27
	public static function filter_connection_status( $status ) {
28
29
		$status['isActive'] = Jetpack::is_connection_ready();
30
31
		return $status;
32
	}
33
34
}
35