/** * {@inheritdoc} */ public function calculate(PriceableInterface $subject, array $context = array()) { if (null === ($type = $subject->getPricingCalculator())) { throw new \InvalidArgumentException('Cannot calculate the price for PriceableInterface instance without calculator defined.'); } $calculator = $this->registry->get($type); return $calculator->calculate($subject, $subject->getPricingConfiguration(), $context); }