Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
66.67% covered (warning)
66.67%
2 / 3
50.00% covered (danger)
50.00%
1 / 2
CRAP
0.00% covered (danger)
0.00%
0 / 1
Jetpack_Connection_Status
66.67% covered (warning)
66.67%
2 / 3
50.00% covered (danger)
50.00%
1 / 2
2.15
0.00% covered (danger)
0.00%
0 / 1
 init
0.00% covered (danger)
0.00%
0 / 1
0.00% covered (danger)
0.00%
0 / 1
2
 filter_connection_status
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
1 / 1
1
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 */
13class 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}