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 | 16 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 7.0671 |
| Changes | 0 | ||
| 1 | <?php |
||
| 27 | 7 | public function isValid($input): bool |
|
| 28 | { |
||
| 29 | 7 | $count = count($input); |
|
| 30 | 7 | if ($count < 2) { |
|
| 31 | return true; |
||
| 32 | } |
||
| 33 | 7 | for ($i = 1; $i < $count; ++$i) { |
|
| 34 | if ( |
||
| 35 | 7 | ($this->ascending && ($this->fn)($input[$i]) < ($this->fn)($input[$i - 1])) |
|
| 36 | 7 | || (!$this->ascending && ($this->fn)($input[$i]) > ($this->fn)($input[$i - 1])) |
|
| 37 | ) { |
||
| 38 | 2 | return false; |
|
| 39 | } |
||
| 40 | } |
||
| 41 | |||
| 42 | 5 | return true; |
|
| 43 | } |
||
| 45 |