public static function getNewInstance(ShippingService $service, $cost) { $inst = new ShipmentDeliveryRate(); $inst->setServiceId($service->getID()); $inst->setApplication($service->getApplication()); $inst->setCost((string) round($cost, 3), $service->getApplication()->getDefaultCurrencyCode()); $inst->setService($service); $inst->setServiceName($service->getValueByLang('name')); return $inst; }