Completed
Push — update/refactor-search-php ( d6a69c )
by
unknown
07:06
created

Jetpack_Search_Options   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 41
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 1

2 Methods

Rating   Name   Duplication   Size   Complexity  
A instant_enabled() 0 3 1
A site_has_vip_index() 0 17 2
1
<?php
2
/**
3
 * Jetpack Search: Jetpack_Search_Options class
4
 *
5
 * @package    Jetpack
6
 * @subpackage Jetpack Search
7
 * @since      8.3.0
8
 */
9
10
use Automattic\Jetpack\Constants;
11
12
/**
13
 * Helpers for parsing the various Search options
14
 *
15
 * @since 8.3.0
16
 */
17
class Jetpack_Search_Options {
18
19
	/**
20
	 * Returns a boolean for whether instant search is enabled.
21
	 *
22
	 * @since 8.3.0
23
	 *
24
	 * @return bool
25
	 */
26
	public static function instant_enabled() {
27
		return Constants::is_true( 'JETPACK_SEARCH_PROTOTYPE' );
28
	}
29
30
31
	/**
32
	 * Returns a boolean for whether the current site has a VIP index.
33
	 *
34
	 * @since 5.8.0
35
	 *
36
	 * @return bool
37
	 */
38
	public static function site_has_vip_index() {
39
		$has_vip_index = (
40
			Constants::is_defined( 'JETPACK_SEARCH_VIP_INDEX' ) &&
41
			Constants::get_constant( 'JETPACK_SEARCH_VIP_INDEX' )
42
		);
43
44
		/**
45
		 * Allows developers to filter whether the current site has a VIP index.
46
		 *
47
		 * @module search
48
		 *
49
		 * @since  5.8.0
50
		 *
51
		 * @param bool $has_vip_index Whether the current site has a VIP index.
52
		 */
53
		return apply_filters( 'jetpack_search_has_vip_index', $has_vip_index );
54
	}
55
56
57
}
58