| Conditions | 5 |
| Paths | 9 |
| Total Lines | 24 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 32 | public function getBounds(): array |
||
| 33 | { |
||
| 34 | $max = PHP_INT_MAX; |
||
| 35 | $min = PHP_INT_MIN; |
||
| 36 | |||
| 37 | $bounds = []; |
||
| 38 | |||
| 39 | foreach ($this as $index => $item) { |
||
| 40 | if ($item instanceof PartitionItemInterface) { |
||
| 41 | $item = $item->getWeight(); |
||
| 42 | } |
||
| 43 | |||
| 44 | if ($item < $max) { |
||
| 45 | $max = $item; |
||
| 46 | $bounds[0] = $index; |
||
| 47 | } |
||
| 48 | |||
| 49 | if ($item > $min) { |
||
| 50 | $min = $item; |
||
| 51 | $bounds[1] = $index; |
||
| 52 | } |
||
| 53 | } |
||
| 54 | |||
| 55 | return $bounds; |
||
| 56 | } |
||
| 76 |