We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
Conditions | 7 |
Paths | 4 |
Total Lines | 15 |
Code Lines | 8 |
Lines | 0 |
Ratio | 0 % |
Tests | 8 |
CRAP Score | 7.0671 |
Changes | 0 |
1 | <?php |
||
33 | 7 | public function validate($input): bool |
|
34 | { |
||
35 | 7 | $count = count($input); |
|
36 | 7 | if ($count < 2) { |
|
37 | return true; |
||
38 | } |
||
39 | 7 | for ($i = 1; $i < $count; ++$i) { |
|
40 | 7 | if (($this->ascending && ($this->fn)($input[$i]) < ($this->fn)($input[$i - 1])) |
|
41 | 7 | || (!$this->ascending && ($this->fn)($input[$i]) > ($this->fn)($input[$i - 1])) |
|
42 | ) { |
||
43 | 2 | return false; |
|
44 | } |
||
45 | } |
||
46 | |||
47 | 5 | return true; |
|
48 | } |
||
50 |