Conditions | 5 |
Paths | 5 |
Total Lines | 15 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
53 | public function validate(string $value, string $pattern, array $stopWords): bool |
||
54 | { |
||
55 | switch ($this->getConfig()->getValidationType()) { |
||
56 | case 1: // Regex |
||
57 | return preg_match($pattern, $value) === 1; |
||
58 | break; |
||
|
|||
59 | case 2: // Stop words |
||
60 | return $this->checkStringForStopWords($value, $stopWords); |
||
61 | break; |
||
62 | case 3: // Regex and stop words |
||
63 | return preg_match($pattern, $value) === 1 && $this->checkStringForStopWords($value, $stopWords); |
||
64 | break; |
||
65 | } |
||
66 | |||
67 | return false; |
||
68 | } |
||
75 |
The
break
statement is not necessary if it is preceded for example by areturn
statement:If you would like to keep this construct to be consistent with other
case
statements, you can safely mark this issue as a false-positive.