public static function createComparer($closure, $sortOrder, &$isReversed)
    {
        if ($closure === null) {
            $isReversed = false;
            return $sortOrder === SORT_DESC ? Functions::$compareStrictReversed : Functions::$compareStrict;
        }
        elseif (is_int($closure)) {
            switch ($closure) {
                case SORT_REGULAR:
                    return Functions::$compareStrict;
                case SORT_NUMERIC:
                    $isReversed = false;
                    return $sortOrder === SORT_DESC ? Functions::$compareIntReversed : Functions::$compareInt;
                case SORT_STRING:
                    return 'strcmp';
                case SORT_STRING | SORT_FLAG_CASE:
                    return 'strcasecmp';
                case SORT_LOCALE_STRING:
                    return 'strcoll';
                case SORT_NATURAL:
                    return 'strnatcmp';
                case SORT_NATURAL | SORT_FLAG_CASE:
                    return 'strnatcasecmp';
                default:
                    throw new \InvalidArgumentException("Unexpected sort flag: {$closure}.");
            }
        }
        return self::createLambda($closure, 'a,b');
    }