We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| Conditions | 5 |
| Paths | 6 |
| Total Lines | 14 |
| Code Lines | 10 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 9 |
| CRAP Score | 5.025 |
| Changes | 0 | ||
| 1 | <?php |
||
| 22 | 5 | public function validate($input) |
|
| 23 | { |
||
| 24 | 5 | $count = count($input); |
|
| 25 | 5 | if($count < 2){ |
|
| 26 | return true; |
||
| 27 | }; |
||
| 28 | 5 | for($i = 1; $i < $count; $i++){ |
|
| 29 | 5 | $cmp = $this->ascending === true |
|
| 30 | 4 | ? ($this->fn)($input[$i]) > ($this->fn)($input[$i - 1]) |
|
| 31 | 5 | : ($this->fn)($input[$i]) < ($this->fn)($input[$i - 1]); |
|
| 32 | 5 | if($cmp === false) return false; |
|
| 33 | } |
||
| 34 | 3 | return true; |
|
| 35 | } |
||
| 36 | } |
||
| 37 |
In PHP it is possible to write to properties without declaring them. For example, the following is perfectly valid PHP code:
Generally, it is a good practice to explictly declare properties to avoid accidental typos and provide IDE auto-completion: