@@ -18,7 +18,7 @@ |
||
| 18 | 18 | { |
| 19 | 19 | /** |
| 20 | 20 | * @throws \Exception |
| 21 | - * @return array |
|
| 21 | + * @return string |
|
| 22 | 22 | */ |
| 23 | 23 | private function getRequestedURL() |
| 24 | 24 | { |
@@ -72,8 +72,7 @@ discard block |
||
| 72 | 72 | { |
| 73 | 73 | try { |
| 74 | 74 | $request = $this->getRequest(); |
| 75 | - } |
|
| 76 | - catch (\Exception $e) { |
|
| 75 | + } catch (\Exception $e) { |
|
| 77 | 76 | $this->sendResponseCode(400); |
| 78 | 77 | return json_encode([ |
| 79 | 78 | 'success' => false, |
@@ -86,16 +85,14 @@ discard block |
||
| 86 | 85 | $response = $this->getProxy() |
| 87 | 86 | ->forward($request) |
| 88 | 87 | ->to($this->getRequestedURL()); |
| 89 | - } |
|
| 90 | - catch (ConnectException $e) { |
|
| 88 | + } catch (ConnectException $e) { |
|
| 91 | 89 | $this->sendResponseCode(400); |
| 92 | 90 | return json_encode([ |
| 93 | 91 | 'success' => false, |
| 94 | 92 | 'message' => 'Connection error', |
| 95 | 93 | 'details' => $e->getMessage(), |
| 96 | 94 | ]); |
| 97 | - } |
|
| 98 | - catch (ClientException $e) { |
|
| 95 | + } catch (ClientException $e) { |
|
| 99 | 96 | $this->sendResponseCode(404); |
| 100 | 97 | return json_encode([ |
| 101 | 98 | 'success' => false, |
@@ -121,12 +118,10 @@ discard block |
||
| 121 | 118 | if ($code === 404) { |
| 122 | 119 | header('HTTP/1.0 404 Not Found'); |
| 123 | 120 | return; |
| 124 | - } |
|
| 125 | - elseif ($code === 403) { |
|
| 121 | + } elseif ($code === 403) { |
|
| 126 | 122 | header('HTTP 1.1 403 Unauthorized'); |
| 127 | 123 | return; |
| 128 | - } |
|
| 129 | - elseif ($code === 400) { |
|
| 124 | + } elseif ($code === 400) { |
|
| 130 | 125 | header('HTTP/1.0 400 Bad Request'); |
| 131 | 126 | return; |
| 132 | 127 | } |