/** * Returns the method's calculator instance * * @param ShippingMethodInterface $shippingMethod * * @return \WellCommerce\Bundle\ShippingBundle\Calculator\ShippingMethodCalculatorInterface */ protected function getCalculator(ShippingMethodInterface $shippingMethod) { $calculator = $shippingMethod->getCalculator(); if (!$this->shippingMethodCalculatorCollection->has($calculator)) { throw new CalculatorNotFoundException($calculator); } return $this->shippingMethodCalculatorCollection->get($calculator); }
private function getCalculator(ShippingMethodInterface $shippingMethod) : ShippingCalculatorInterface { $calculator = $shippingMethod->getCalculator(); if (false === $this->calculators->containsKey($calculator)) { throw new CalculatorNotFoundException($calculator); } return $this->calculators->get($calculator); }