compare($item, $order)) { ++$pos; } } if ($pos === $start) { continue; } while ($item->equals($list[$pos])) { ++$pos; } $old = $list[$pos]; $list[$pos] = $item; $item = $old; while ($pos !== $start) { $pos = $start; $length1 = \count($list); for ($i = $start + 1; $i < $length1; ++$i) { if (!$list[$i]->compare($item, $order)) { ++$pos; } } while ($item->equals($list[$pos])) { ++$pos; } $old = $list[$pos]; $list[$pos] = $item; $item = $old; } } return $list; } }