@@ 45-53 (lines=9) @@ | ||
42 | } |
|
43 | ||
44 | if (EqualRule::operator === $operator) { |
|
45 | if (! isset($value_to_validate)) { |
|
46 | // ['field', '=', null] <=> isset($row['field']) |
|
47 | // [row, '=', null] <=> $row !== null |
|
48 | $result = null === $value; |
|
49 | } |
|
50 | else { |
|
51 | // TODO support strict comparisons |
|
52 | $result = $value_to_validate == $value; |
|
53 | } |
|
54 | } |
|
55 | elseif (InRule::operator === $operator) { |
|
56 | $result = in_array( |
|
@@ 61-68 (lines=8) @@ | ||
58 | $value |
|
59 | ); |
|
60 | } |
|
61 | elseif (BelowRule::operator === $operator) { |
|
62 | if (! isset($value_to_validate)) { |
|
63 | $result = false; |
|
64 | } |
|
65 | else { |
|
66 | $result = $value_to_validate < $value; |
|
67 | } |
|
68 | } |
|
69 | elseif (AboveRule::operator === $operator) { |
|
70 | if (! isset($value_to_validate)) { |
|
71 | $result = false; |
|
@@ 69-76 (lines=8) @@ | ||
66 | $result = $value_to_validate < $value; |
|
67 | } |
|
68 | } |
|
69 | elseif (AboveRule::operator === $operator) { |
|
70 | if (! isset($value_to_validate)) { |
|
71 | $result = false; |
|
72 | } |
|
73 | else { |
|
74 | $result = $value_to_validate > $value; |
|
75 | } |
|
76 | } |
|
77 | elseif (NotEqualRule::operator === $operator) { |
|
78 | if (null === $value) { |
|
79 | $result = isset($value_to_validate); |
|
@@ 77-84 (lines=8) @@ | ||
74 | $result = $value_to_validate > $value; |
|
75 | } |
|
76 | } |
|
77 | elseif (NotEqualRule::operator === $operator) { |
|
78 | if (null === $value) { |
|
79 | $result = isset($value_to_validate); |
|
80 | } |
|
81 | else { |
|
82 | $result = $value_to_validate != $value; |
|
83 | } |
|
84 | } |
|
85 | elseif (NotInRule::operator === $operator) { |
|
86 | $result = ! in_array( |
|
87 | isset($value_to_validate) ? $value_to_validate : null, |
|
@@ 91-98 (lines=8) @@ | ||
88 | $value |
|
89 | ); |
|
90 | } |
|
91 | elseif (AboveOrEqualRule::operator === $operator) { |
|
92 | if (! isset($value_to_validate)) { |
|
93 | $result = false; |
|
94 | } |
|
95 | else { |
|
96 | $result = $value_to_validate >= $value; |
|
97 | } |
|
98 | } |
|
99 | elseif (BelowOrEqualRule::operator === $operator) { |
|
100 | if (! isset($value_to_validate)) { |
|
101 | $result = false; |
|
@@ 99-106 (lines=8) @@ | ||
96 | $result = $value_to_validate >= $value; |
|
97 | } |
|
98 | } |
|
99 | elseif (BelowOrEqualRule::operator === $operator) { |
|
100 | if (! isset($value_to_validate)) { |
|
101 | $result = false; |
|
102 | } |
|
103 | else { |
|
104 | $result = $value_to_validate <= $value; |
|
105 | } |
|
106 | } |
|
107 | elseif (RegexpRule::operator === $operator) { |
|
108 | if (! isset($value_to_validate)) { |
|
109 | $result = false; |