/** * calculate and return delivery price * * @param Country $country * @throws \Exception * * @return mixed */ public function getPostage(Country $country) { if ($country !== null && $country->getArea() !== null) { $postage = $country->getArea()->getPostage(); } else { throw new \InvalidArgumentException("Country or Area should not be null"); } return $postage === null ? 0 : $postage; }