if ($timeSel == "") { $timeSel = "depart"; } if ($results == "" || $results > 6 || $results < 1) { $results = 6; } if ($date == "") { $date = date("dmy"); } //TODO: move this to constructor of ConnectionRequest //reform date to needed train structure preg_match("/(..)(..)(..)/si", $date, $m); $date = "20" . $m[3] . $m[2] . $m[1]; if ($time == "") { $time = date("Hi"); } //reform time to wanted structure preg_match("/(..)(..)/si", $time, $m); $time = $m[1] . ":" . $m[2]; if ($typeOfTransport == "") { $typeOfTransport = "train"; } if (!isset($from) || !isset($to)) { $e = new Exception("You didn't use this right. You should specify where to and where from you are traveling.", 1); $eh = new ErrorHandler($e, $format); $eh->printError(); } else { $request = new ConnectionRequest($from, $to, $time, $date, $timeSel, $results, $lang, $format, $typeOfTransport); $call = new ConnectionsCall("connections", $request); $call->executeCall(); }
protected function processError(Exception $e) { writeLog($_SERVER['HTTP_USER_AGENT'], "", "", "Error in {$this->functionname} " . $e->getMessage(), $_SERVER['REMOTE_ADDR']); $eh = new ErrorHandler($e, $this->request->getFormat()); $eh->printError(); }