code: public static function compareFunctionFor(Comparator $comparator) : callable
      {
          return function ($object1, $object2) use ($comparator) {
              return $comparator->compare($object1, $object2);
          };
      }
docs: 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