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 | 9 |
CRAP Score | 7 |
Changes | 0 |
1 | <?php |
||
45 | 10 | public function validate($input): bool |
|
46 | { |
||
47 | 10 | $count = count($input); |
|
48 | 10 | if ($count < 2) { |
|
49 | 1 | return true; |
|
50 | } |
||
51 | 9 | for ($i = 1; $i < $count; ++$i) { |
|
52 | 9 | if (($this->ascending && ($this->fn)($input[$i]) < ($this->fn)($input[$i - 1])) |
|
53 | 9 | || (!$this->ascending && ($this->fn)($input[$i]) > ($this->fn)($input[$i - 1])) |
|
54 | ) { |
||
55 | 4 | return false; |
|
56 | } |
||
57 | } |
||
58 | |||
59 | 6 | return true; |
|
60 | } |
||
62 |