Code Duplication    Length = 17-17 lines in 4 locations

core/Container/Condition/Post_ID_Condition.php 1 location

@@ 8-24 (lines=17) @@
5
/**
6
 * Check for a specific post id
7
 */
8
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
}

core/Container/Condition/Post_Type_Condition.php 1 location

@@ 8-24 (lines=17) @@
5
/**
6
 * Check is post is of specific type
7
 */
8
class Post_Type_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_type = $environment['post_type'];
18
		return $this->compare(
19
			$post_type,
20
			$this->get_comparison_operator(),
21
			$this->get_value()
22
		);
23
	}
24
}

core/Container/Condition/Term_Taxonomy_Condition.php 1 location

@@ 8-24 (lines=17) @@
5
/**
6
 * Check if term is of a specific taxonomy
7
 */
8
class Term_Taxonomy_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
		$taxonomy = $environment['taxonomy'];
18
		return $this->compare(
19
			$taxonomy,
20
			$this->get_comparison_operator(),
21
			$this->get_value()
22
		);
23
	}
24
}

core/Container/Condition/User_ID_Condition.php 1 location

@@ 8-24 (lines=17) @@
5
/**
6
 * Check for a specific user id
7
 */
8
class User_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
		$user_id = $environment['user_id'];
18
		return $this->compare(
19
			$user_id,
20
			$this->get_comparison_operator(),
21
			$this->get_value()
22
		);
23
	}
24
}