src/precore/util/Ordering.php
public function onResultOf(callable $function) : Ordering
    {
        return Ordering::from(Collections::comparatorFrom(
            function ($object1, $object2) use ($function) {
                return $this->compare(
                    Functions::call($function, $object1),
                    Functions::call($function, $object2)
                );
            }
        ));
    }
public function onResultOf(callable $function) : Ordering
    {
        return Ordering::from(Collections::comparatorFrom(
            function ($object1, $object2) use ($function) {
                return $this->compare(
                    Functions::call($function, $object1),
                    Functions::call($function, $object2)
                );
            }
        ));
    }
Returns a new ordering which orders elements by first applying a function to them,
then comparing those results using this.

@param callable $function
@return Ordering