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

Status   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 30
Duplicated Lines 76.67 %

Coupling/Cohesion

Components 0
Dependencies 0

Importance

Changes 0
Metric Value
dl 23
loc 30
rs 10
c 0
b 0
f 0
wmc 3
lcom 0
cbo 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A is_development_mode() 23 23 3

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

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