Completed
Push — add/signature-error-reporting ( 95a087...072d13 )
by
unknown
18:31 queued 09:22
created

Status::is_development_mode()   A

Complexity

Conditions 3
Paths 3

Size

Total Lines 23

Duplication

Lines 23
Ratio 100 %

Importance

Changes 0
Metric Value
cc 3
nc 3
nop 0
dl 23
loc 23
rs 9.552
c 0
b 0
f 0
1
<?php
2
/**
3
 * A status class for Jetpack.
4
 *
5
 * @package jetpack-status
6
 */
7
8
namespace Automattic\Jetpack;
9
10
/**
11
 * Class Automattic\Jetpack\Status
12
 *
13
 * Used to retrieve information about the current status of Jetpack and the site overall.
14
 */
15
class Status {
16
	/**
17
	 * Is Jetpack in development (offline) mode?
18
	 *
19
	 * @return bool Whether Jetpack's development mode is active.
20
	 */
21 View Code Duplication
	public function is_development_mode() {
22
		$development_mode = false;
23
		$site_url         = site_url();
24
25
		if ( defined( '\\JETPACK_DEV_DEBUG' ) ) {
26
			$development_mode = constant( '\\JETPACK_DEV_DEBUG' );
27
		} elseif ( $site_url ) {
28
			$development_mode = false === strpos( $site_url, '.' );
29
		}
30
31
		/**
32
		 * Filters Jetpack's development mode.
33
		 *
34
		 * @see https://jetpack.com/support/development-mode/
35
		 *
36
		 * @since 2.2.1
37
		 *
38
		 * @param bool $development_mode Is Jetpack's development mode active.
39
		 */
40
		$development_mode = (bool) apply_filters( 'jetpack_development_mode', $development_mode );
41
42
		return $development_mode;
43
	}
44
}
45