Post_ID_Condition   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 17
Duplicated Lines 100 %

Coupling/Cohesion

Components 1
Dependencies 1

Test Coverage

Coverage 0%

Importance

Changes 0
Metric Value
dl 17
loc 17
ccs 0
cts 7
cp 0
rs 10
c 0
b 0
f 0
wmc 1
lcom 1
cbo 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A is_fulfilled() 8 8 1

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
namespace Carbon_Fields\Container\Condition;
4
5
/**
6
 * Check for a specific post id
7
 */
8 View Code Duplication
class Post_ID_Condition extends Condition {
9
10
	/**
11
	 * Check if the condition is fulfilled
12
	 *
13
	 * @param  array $environment
14
	 * @return bool
15
	 */
16
	public function is_fulfilled( $environment ) {
17
		$post_id = $environment['post_id'];
18
		return $this->compare(
19
			$post_id,
20
			$this->get_comparison_operator(),
21
			$this->get_value()
22
		);
23
	}
24
}