public function sortDeliveries(): self
    {
        $this->sort(function (Delivery $a, Delivery $b) {
            if ($a->getLocation() !== $b->getLocation()) {
                return -1;
            }

            return $a->getDeliveryDate()->getEarliest() > $b->getDeliveryDate()->getEarliest();
        });

        return $this;
    }
public function sortDeliveries(): self
    {
        $this->sort(function (Delivery $a, Delivery $b) {
            if ($a->getLocation() !== $b->getLocation()) {
                return -1;
            }

            return $a->getDeliveryDate()->getEarliest() > $b->getDeliveryDate()->getEarliest();
        });

        return $this;
    }
public function sortDeliveries ( ) : self { $ this -> sort ( function ( Delivery $ a , Delivery $ b ) { if ( $ a -> getLocation ( ) !== $ b -> getLocation ( ) ) { return - 1 ; } return $ a -> getDeliveryDate ( ) -> getEarliest ( ) > $ b -> getDeliveryDate ( ) -> getEarliest ( ) ; } ) ; return $ this ; }
Sorts the delivery collection by earliest delivery date
Sorts the delivery collection by earliest delivery date