Source of file ShippingCalculator.php
Size: 0,660 Bytes - Last Modified: 2021-12-23T10:25:09+00:00
/var/www/docs.ssmods.com/process/src/src/ShippingCalculator.php
123456789101112131415161718192021222324252627282930 | <?php namespace SilverShop\Shipping; use SilverShop\Shipping\Model\ShippingMethod; use SilverShop\Model\Order; /** * Helper class for encapsulating shipping calculation logic. */ class ShippingCalculator { protected $method; protected $order; public function __construct(ShippingMethod $method, Order $order) { $this->method = $method; $this->order = $order; } public function calculate($address = null, $value=null) { return $this->method->calculateRate( $this->order->createShippingPackage($value), $address ? $address : $this->order->getShippingAddress() ); } } |