DVDoug\BoxPacker\ItemList::compare PHP Method

compare() public method

Compare elements in order to place them correctly in the heap while sifting up.
See also: SplMaxHeap::compare()
public compare ( $itemA, $itemB )
    public function compare($itemA, $itemB)
    {
        if ($itemA->getVolume() > $itemB->getVolume()) {
            return 1;
        } elseif ($itemA->getVolume() < $itemB->getVolume()) {
            return -1;
        } else {
            return $itemA->getWeight() - $itemB->getWeight();
        }
    }