Shipment/Resolver/ShipmentPriceResolver.php
private function resolvePrice(array $entry, $weight)
    {
        $price = $count = 0;

        if ($weight > $entry['max_weight']) {
            $count = floor($weight / $entry['max_weight']);
            $weight = round(fmod($weight, $count), 3);
        }

        if (0 < $count) {
            $max = end($entry['prices'])['price'];
            $price = $count * $max;
        }

        foreach ($entry['prices'] as $p) {
            // If sale weight is lower than price weight
            if (1 === bccomp($p['weight'], $weight, 3)) {
                $price += $p['price'];
                break;
            }
        }

        return $price;
    }
private function resolvePrice(array $entry, $weight)
    {
        $price = $count = 0;

        if ($weight > $entry['max_weight']) {
            $count = floor($weight / $entry['max_weight']);
            $weight = round(fmod($weight, $count), 3);
        }

        if (0 < $count) {
            $max = end($entry['prices'])['price'];
            $price = $count * $max;
        }

        foreach ($entry['prices'] as $p) {
            // If sale weight is lower than price weight
            if (1 === bccomp($p['weight'], $weight, 3)) {
                $price += $p['price'];
                break;
            }
        }

        return $price;
    }
private function resolvePrice ( array $ entry , $ weight ) { $ price = $ count = 0 ; if ( $ weight > $ entry [ 'max_weight' ] ) { $ count = floor ( $ weight / $ entry [ 'max_weight' ] ) ; $ weight = round ( fmod ( $ weight , $ count ) , 3 ) ; } if ( 0 < $ count ) { $ max = end ( $ entry [ 'prices' ] ) [ 'price' ] ; $ price = $ count * $ max ; } foreach ( $ entry [ 'prices' ] as $ p ) { // If sale weight is lower than price weight if ( 1 === bccomp ( $ p [ 'weight' ] , $ weight , 3 ) ) { $ price += $ p [ 'price' ] ; break ; } } return $ price ; }
Resolves the price form the given grid entry and total weight.

@param array $entry
@param float $weight

@return float
Resolves the price form the given grid entry and total weight .