public function sort(array $array): array {
        $array = \array_values($array);
        $length = \count($array);

        if (0 === $length || 1 === $length) return $array;

        for ($i = 0; $i < $length; $i++) {
            $min = $i;
            for ($j = $i; $j < $length; $j++) {
                if (Comparator::lessThan($array[$j], $array[$min])) {
                    $min = $j;
                }
            }
            $tmp = $array[$min];
            $array[$min] = $array[$i];
            $array[$i] = $tmp;
        }
        return $array;
    }