| Conditions | 2 |
| Paths | 2 |
| Total Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 6 |
| Changes | 0 | ||
| 1 | <?php |
||
| 39 | public function lastIndexOf($element): int |
||
| 40 | { |
||
| 41 | $elements = array_reverse($this->toArray()); |
||
| 42 | |||
| 43 | $index = array_search($element, $elements, true); |
||
| 44 | |||
| 45 | // return -1 if not found or (size - index found - 1) to return the index of the element after reverse |
||
| 46 | return false === $index ? -1 : $this->count() - $index - 1; |
||
| 47 | } |
||
| 48 | } |
||
| 49 |