Completed
Push — master ( c4606f...2cda3d )
by
unknown
15:54 queued 06:31
created

Any_Equality_Comparer   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 27
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A is_correct() 0 9 3
1
<?php
2
3
namespace Carbon_Fields\Container\Condition\Comparer;
4
5
class Any_Equality_Comparer extends Comparer {
6
7
	/**
8
	 * Supported comparison signs
9
	 *
10
	 * @var array<string>
11
	 */
12
	protected $supported_comparison_operators = array( '=', '!=' );
13
14
	/**
15
	 * Check if comparison is true for $a and $b
16
	 *
17
	 * @param mixed  $a
18
	 * @param string $comparison_operator
19
	 * @param mixed  $b
20
	 * @return bool
21
	 */
22
	public function is_correct( $a, $comparison_operator, $b ) {
2 ignored issues
show
Comprehensibility introduced by
Avoid variables with short names like $a. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
Comprehensibility introduced by
Avoid variables with short names like $b. Configured minimum length is 3.

Short variable names may make your code harder to understand. Variable names should be self-descriptive. This check looks for variable names who are shorter than a configured minimum.

Loading history...
23
		switch ( $comparison_operator ) {
24
			case '=':
25
				return in_array( $b, $a );
26
			case '!=':
27
				return ! in_array( $b, $a );
28
		}
29
		return false;
30
	}
31
}