src/precore/util/Collections.php
public static function compareFunctionFor(Comparator $comparator) : callable
    {
        return function ($object1, $object2) use ($comparator) {
            return $comparator->compare($object1, $object2);
        };
    }
public static function compareFunctionFor(Comparator $comparator) : callable
    {
        return function ($object1, $object2) use ($comparator) {
            return $comparator->compare($object1, $object2);
        };
    }
Creates a comparator function based on the given {@link Comparator} thus it can be passed
to any native sorting function like {@link usort}.

@param Comparator $comparator
@return callable