| Conditions | 5 | 
| Paths | 6 | 
| Total Lines | 7 | 
| Code Lines | 4 | 
| Lines | 0 | 
| Ratio | 0 % | 
| Changes | 1 | ||
| Bugs | 0 | Features | 0 | 
| 1 | <?php  | 
            ||
| 27 | public static function normalizeIndex(int $index, int $containerLength, bool $throwError = true): int  | 
            ||
| 28 |     { | 
            ||
| 29 | $dist = $index >= 0 ? $index : \abs($index) - 1;  | 
            ||
| 30 |         if ($throwError && $dist >= $containerLength) { | 
            ||
| 31 |             throw new IndexError("Index {$index} is out of range."); | 
            ||
| 32 | }  | 
            ||
| 33 | return $index < 0 ? $containerLength + $index : $index;  | 
            ||
| 34 | }  | 
            ||
| 52 |