Document/Calculator/DocumentCalculator.php
protected function calculateShipmentLine(Model\DocumentLineInterface $line, Amount $final): Amount
    {
        if ($line->getType() !== Model\DocumentLineTypes::TYPE_SHIPMENT) {
            throw new LogicException(sprintf(
                "Expected document line with type '%s'.",
                Model\DocumentLineTypes::TYPE_SHIPMENT
            ));
        }

        $sale = $line->getDocument()->getSale();

        $result = $this->calculator->calculateSaleShipment($sale, $final);

        if (null === $result) {
            throw new LogicException("Unexpected document shipment line.");
        }

        $this->syncLineWithResult($line, $result);

        return $result;
    }
protected function calculateShipmentLine(Model\DocumentLineInterface $line, Amount $final): Amount
    {
        if ($line->getType() !== Model\DocumentLineTypes::TYPE_SHIPMENT) {
            throw new LogicException(sprintf(
                "Expected document line with type '%s'.",
                Model\DocumentLineTypes::TYPE_SHIPMENT
            ));
        }

        $sale = $line->getDocument()->getSale();

        $result = $this->calculator->calculateSaleShipment($sale, $final);

        if (null === $result) {
            throw new LogicException("Unexpected document shipment line.");
        }

        $this->syncLineWithResult($line, $result);

        return $result;
    }
protected function calculateShipmentLine ( Model \ DocumentLineInterface $ line , Amount $ final ) : Amount { if ( $ line -> getType ( ) !== Model \ DocumentLineTypes :: TYPE_SHIPMENT ) { throw new LogicException ( sprintf ( "Expected document line with type '%s'." , Model \ DocumentLineTypes :: TYPE_SHIPMENT ) ) ; } $ sale = $ line -> getDocument ( ) -> getSale ( ) ; $ result = $ this -> calculator -> calculateSaleShipment ( $ sale , $ final ) ; if ( null === $ result ) { throw new LogicException ( "Unexpected document shipment line." ) ; } $ this -> syncLineWithResult ( $ line , $ result ) ; return $ result ; }
Calculate the shipment line.

@param Model\DocumentLineInterface $line
@param Amount                      $final

@return Amount
@throws LogicException
Calculate the shipment line .