public static function calculate($fromDDD, $toDDD, $duration, $planId) { $price = @PriceBus::getByRoute($fromDDD, $toDDD); if ($price != null) { $normal_price = $price->calculateCallCost($duration); $plan = @PlanBus::getById($planId); if ($plan != null) { return array("normal" => $normal_price, "plan" => $plan->calculateCallCost($price, $duration)); } else { return array("normal" => $normal_price, "plan" => "Plan not found"); } } return null; }