@@ -14,7 +14,7 @@ |
||
| 14 | 14 | /** |
| 15 | 15 | * @param array $data |
| 16 | 16 | */ |
| 17 | - public function __construct(array $data){ |
|
| 17 | + public function __construct(array $data) { |
|
| 18 | 18 | $this->data = $data; |
| 19 | 19 | } |
| 20 | 20 | |
@@ -45,7 +45,7 @@ discard block |
||
| 45 | 45 | * @param Configuration $formatsConfig |
| 46 | 46 | * @param string $endpointNamespace |
| 47 | 47 | */ |
| 48 | - public function __construct(AccessControl $accessControl, Throttle $throttle, Configuration $formatsConfig, $endpointNamespace = ''){ |
|
| 48 | + public function __construct(AccessControl $accessControl, Throttle $throttle, Configuration $formatsConfig, $endpointNamespace = '') { |
|
| 49 | 49 | $this->accessControl = $accessControl; |
| 50 | 50 | $this->throttle = $throttle; |
| 51 | 51 | $this->formatsConfig = $formatsConfig; |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @throws UnknownEndpointException |
| 63 | 63 | * @throws UnknownResponseFormatException |
| 64 | 64 | */ |
| 65 | - public function handle(Request $request){ |
|
| 65 | + public function handle(Request $request) { |
|
| 66 | 66 | $this->validateKey($request); |
| 67 | 67 | |
| 68 | 68 | $this->validateExtension($request); |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | * @param Request $request |
| 91 | 91 | * @return string |
| 92 | 92 | */ |
| 93 | - private function endpointClass(Request $request){ |
|
| 93 | + private function endpointClass(Request $request) { |
|
| 94 | 94 | return '\\' . $this->endpointNamespace . '\Endpoints\v' . str_replace('.', '_', $request->getVersion()) . '\\' . $request->getEndpoint(); |
| 95 | 95 | } |
| 96 | 96 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @param Request $request |
| 99 | 99 | * @return string |
| 100 | 100 | */ |
| 101 | - private function responseClass(Request $request){ |
|
| 101 | + private function responseClass(Request $request) { |
|
| 102 | 102 | return '\\LunixREST\\Response\\' . strtoupper($request->getExtension()) . "Response"; |
| 103 | 103 | } |
| 104 | 104 | |
@@ -106,8 +106,8 @@ discard block |
||
| 106 | 106 | * @param Request $request |
| 107 | 107 | * @throws InvalidAPIKeyException |
| 108 | 108 | */ |
| 109 | - private function validateKey(Request $request){ |
|
| 110 | - if(!$this->accessControl->validateKey($request->getApiKey())){ |
|
| 109 | + private function validateKey(Request $request) { |
|
| 110 | + if (!$this->accessControl->validateKey($request->getApiKey())) { |
|
| 111 | 111 | throw new InvalidAPIKeyException('Invalid API key'); |
| 112 | 112 | } |
| 113 | 113 | } |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | private function validateExtension(Request $request) |
| 121 | 121 | { |
| 122 | 122 | $formats = $this->formatsConfig->get('formats'); |
| 123 | - if(!($formats && in_array($request->getExtension(), $formats))){ |
|
| 124 | - throw new UnknownResponseFormatException('Unknown response format: ' .$request->getExtension()); |
|
| 123 | + if (!($formats && in_array($request->getExtension(), $formats))) { |
|
| 124 | + throw new UnknownResponseFormatException('Unknown response format: ' . $request->getExtension()); |
|
| 125 | 125 | } |
| 126 | 126 | } |
| 127 | 127 | |
@@ -129,9 +129,9 @@ discard block |
||
| 129 | 129 | * @param $fullEndpoint |
| 130 | 130 | * @throws UnknownEndpointException |
| 131 | 131 | */ |
| 132 | - private function validateEndpoint($fullEndpoint){ |
|
| 132 | + private function validateEndpoint($fullEndpoint) { |
|
| 133 | 133 | $endpointReflection = new \ReflectionClass($fullEndpoint); |
| 134 | - if(!class_exists($fullEndpoint) || !$endpointReflection->isSubclassOf('\LunixREST\Endpoints\Endpoint')){ |
|
| 134 | + if (!class_exists($fullEndpoint) || !$endpointReflection->isSubclassOf('\LunixREST\Endpoints\Endpoint')) { |
|
| 135 | 135 | throw new UnknownEndpointException("unknown endpoint: " . $fullEndpoint); |
| 136 | 136 | } |
| 137 | 137 | } |
@@ -140,8 +140,8 @@ discard block |
||
| 140 | 140 | * @param Request $request |
| 141 | 141 | * @throws ThrottleLimitExceededException |
| 142 | 142 | */ |
| 143 | - private function throttle(Request $request){ |
|
| 144 | - if($this->throttle->throttle($request)){ |
|
| 143 | + private function throttle(Request $request) { |
|
| 144 | + if ($this->throttle->throttle($request)) { |
|
| 145 | 145 | throw new ThrottleLimitExceededException('Request limit exceeded'); |
| 146 | 146 | } |
| 147 | 147 | } |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | * @param Request $request |
| 151 | 151 | * @throws AccessDeniedException |
| 152 | 152 | */ |
| 153 | - private function validateAccess(Request $request){ |
|
| 154 | - if(!$this->accessControl->validateAccess($request)){ |
|
| 153 | + private function validateAccess(Request $request) { |
|
| 154 | + if (!$this->accessControl->validateAccess($request)) { |
|
| 155 | 155 | throw new AccessDeniedException("API key does not have the required permissions to access requested resource"); |
| 156 | 156 | } |
| 157 | 157 | } |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | * @param $responseData |
| 161 | 161 | * @throws InvalidResponseFormatException |
| 162 | 162 | */ |
| 163 | - private function validateResponse($responseData){ |
|
| 164 | - if(!is_array($responseData)){ |
|
| 163 | + private function validateResponse($responseData) { |
|
| 164 | + if (!is_array($responseData)) { |
|
| 165 | 165 | throw new InvalidResponseFormatException('Method output MUST be an array'); |
| 166 | 166 | } |
| 167 | 167 | } |
@@ -22,11 +22,11 @@ discard block |
||
| 22 | 22 | * @param $file |
| 23 | 23 | * @param $limitPerMinute |
| 24 | 24 | */ |
| 25 | - public function __construct($file, $limitPerMinute){ |
|
| 25 | + public function __construct($file, $limitPerMinute) { |
|
| 26 | 26 | $this->db = new \SQLite3($file); |
| 27 | 27 | |
| 28 | 28 | $result = $this->db->query('SELECT name FROM sqlite_master'); |
| 29 | - if(!($row = $result->fetchArray()) || $row['name'] != 'throttle'){ |
|
| 29 | + if (!($row = $result->fetchArray()) || $row['name'] != 'throttle') { |
|
| 30 | 30 | $this->db->exec('CREATE TABLE throttle (key STRING, count NUMBER, lastMinute NUMBER)'); |
| 31 | 31 | } |
| 32 | 32 | $this->limit = $limitPerMinute; |
@@ -42,11 +42,11 @@ discard block |
||
| 42 | 42 | * @param $key |
| 43 | 43 | * @return bool |
| 44 | 44 | */ |
| 45 | - protected function genericThrottle($key){ |
|
| 45 | + protected function genericThrottle($key) { |
|
| 46 | 46 | $minute = ceil(time() / 60); |
| 47 | - if($result = $this->db->querySingle('SELECT key, count, lastMinute FROM throttle WHERE key = ' . \SQLite3::escapeString($key), true)) { |
|
| 48 | - if($result['lastMinute'] == $minute){ |
|
| 49 | - if($result['count'] + 1 <= $this->limit){ |
|
| 47 | + if ($result = $this->db->querySingle('SELECT key, count, lastMinute FROM throttle WHERE key = ' . \SQLite3::escapeString($key), true)) { |
|
| 48 | + if ($result['lastMinute'] == $minute) { |
|
| 49 | + if ($result['count'] + 1 <= $this->limit) { |
|
| 50 | 50 | $this->db->query('UPDATE throttle SET count = ' . ($result['count'] + 1) . ' WHERE key = ' . \SQLite3::escapeString($key)); |
| 51 | 51 | } else { |
| 52 | 52 | return true; |
@@ -7,7 +7,7 @@ |
||
| 7 | 7 | class phonenumbers extends Endpoint { |
| 8 | 8 | |
| 9 | 9 | public function get(){ |
| 10 | - $geoPhone = new GeoPhone('data.csv'); |
|
| 11 | - return $geoPhone->lookupNumber($this->request->getInstance()); |
|
| 12 | - } |
|
| 10 | + $geoPhone = new GeoPhone('data.csv'); |
|
| 11 | + return $geoPhone->lookupNumber($this->request->getInstance()); |
|
| 12 | + } |
|
| 13 | 13 | } |
| 14 | 14 | \ No newline at end of file |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class phonenumbers extends Endpoint { |
| 8 | 8 | |
| 9 | - public function get(){ |
|
| 9 | + public function get() { |
|
| 10 | 10 | $geoPhone = new GeoPhone('data.csv'); |
| 11 | 11 | return $geoPhone->lookupNumber($this->request->getInstance()); |
| 12 | 12 | } |
@@ -14,7 +14,7 @@ discard block |
||
| 14 | 14 | /** |
| 15 | 15 | * @param string $filename |
| 16 | 16 | */ |
| 17 | - public function __construct($filename = 'data.csv'){ |
|
| 17 | + public function __construct($filename = 'data.csv') { |
|
| 18 | 18 | $this->fileHandle = fopen($filename, 'r'); |
| 19 | 19 | } |
| 20 | 20 | |
@@ -23,13 +23,13 @@ discard block |
||
| 23 | 23 | * @return array an array with one value keyed with "location". The value is an array with two keys "city" and "state". |
| 24 | 24 | * City and state are empty when not found. |
| 25 | 25 | */ |
| 26 | - public function lookupNumber($phoneNumber){ |
|
| 26 | + public function lookupNumber($phoneNumber) { |
|
| 27 | 27 | $phoneNumber = preg_replace('/[^0-9]/s', '', $phoneNumber); |
| 28 | 28 | $areaCode = substr($phoneNumber, 0, 3); |
| 29 | 29 | $nextThree = substr($phoneNumber, 3, 3); |
| 30 | 30 | |
| 31 | 31 | while (($data = fgetcsv($this->fileHandle)) !== FALSE) { |
| 32 | - if($areaCode == $data[0] && $nextThree == $data[1]){ |
|
| 32 | + if ($areaCode == $data[0] && $nextThree == $data[1]) { |
|
| 33 | 33 | return ["location" => |
| 34 | 34 | [ |
| 35 | 35 | 'city' => $data[2], |
@@ -10,29 +10,29 @@ |
||
| 10 | 10 | $router = new \LunixREST\Router\Router($accessControl, $throttle, $formatsConfig, "GeoPhone"); |
| 11 | 11 | |
| 12 | 12 | try { |
| 13 | - $request = new \LunixREST\Request\Request("GET", [], [], '127.0.0.1', "/1/123456/phonenumbers/6517855237.json");//new \LunixREST\Request\Request($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
| 13 | + $request = new \LunixREST\Request\Request("GET", [], [], '127.0.0.1', "/1/123456/phonenumbers/6517855237.json");//new \LunixREST\Request\Request($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
| 14 | 14 | |
| 15 | - try { |
|
| 16 | - echo $router->handle($request); |
|
| 17 | - } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
|
| 18 | - header('400 Bad Request', 400); |
|
| 19 | - } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
| 20 | - header('404 Not Found', 404); |
|
| 21 | - } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
| 22 | - header('404 Not Found', 404); |
|
| 23 | - } catch(\LunixREST\Exceptions\InstanceNotFoundException $e){ |
|
| 24 | - header('404 Not Found', 404); |
|
| 25 | - } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
| 26 | - header('403 Access Denied', 403); |
|
| 27 | - } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
| 28 | - header('429 Too Many Requests', 429); |
|
| 29 | - } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
| 30 | - header('500 Internal Server Error', 500); |
|
| 31 | - } catch(Exception $e){ |
|
| 32 | - header('500 Internal Server Error', 500); |
|
| 33 | - } |
|
| 15 | + try { |
|
| 16 | + echo $router->handle($request); |
|
| 17 | + } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
|
| 18 | + header('400 Bad Request', 400); |
|
| 19 | + } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
| 20 | + header('404 Not Found', 404); |
|
| 21 | + } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
| 22 | + header('404 Not Found', 404); |
|
| 23 | + } catch(\LunixREST\Exceptions\InstanceNotFoundException $e){ |
|
| 24 | + header('404 Not Found', 404); |
|
| 25 | + } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
| 26 | + header('403 Access Denied', 403); |
|
| 27 | + } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
| 28 | + header('429 Too Many Requests', 429); |
|
| 29 | + } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
| 30 | + header('500 Internal Server Error', 500); |
|
| 31 | + } catch(Exception $e){ |
|
| 32 | + header('500 Internal Server Error', 500); |
|
| 33 | + } |
|
| 34 | 34 | } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
| 35 | - header('400 Bad Request', 400); |
|
| 35 | + header('400 Bad Request', 400); |
|
| 36 | 36 | } catch(Exception $e){ |
| 37 | - header('500 Internal Server Error', 500); |
|
| 37 | + header('500 Internal Server Error', 500); |
|
| 38 | 38 | } |
@@ -10,29 +10,29 @@ |
||
| 10 | 10 | $router = new \LunixREST\Router\Router($accessControl, $throttle, $formatsConfig, "GeoPhone"); |
| 11 | 11 | |
| 12 | 12 | try { |
| 13 | - $request = new \LunixREST\Request\Request("GET", [], [], '127.0.0.1', "/1/123456/phonenumbers/6517855237.json");//new \LunixREST\Request\Request($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
| 13 | + $request = new \LunixREST\Request\Request("GET", [], [], '127.0.0.1', "/1/123456/phonenumbers/6517855237.json"); //new \LunixREST\Request\Request($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
| 14 | 14 | |
| 15 | 15 | try { |
| 16 | 16 | echo $router->handle($request); |
| 17 | - } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
|
| 17 | + } catch (\LunixREST\Exceptions\InvalidRequestFormatException $e) { |
|
| 18 | 18 | header('400 Bad Request', 400); |
| 19 | - } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
| 19 | + } catch (\LunixREST\Exceptions\UnknownEndpointException $e) { |
|
| 20 | 20 | header('404 Not Found', 404); |
| 21 | - } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
| 21 | + } catch (\LunixREST\Exceptions\UnknownResponseFormatException $e) { |
|
| 22 | 22 | header('404 Not Found', 404); |
| 23 | - } catch(\LunixREST\Exceptions\InstanceNotFoundException $e){ |
|
| 23 | + } catch (\LunixREST\Exceptions\InstanceNotFoundException $e) { |
|
| 24 | 24 | header('404 Not Found', 404); |
| 25 | - } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
| 25 | + } catch (\LunixREST\Exceptions\AccessDeniedException $e) { |
|
| 26 | 26 | header('403 Access Denied', 403); |
| 27 | - } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
| 27 | + } catch (\LunixREST\Exceptions\ThrottleLimitExceededException $e) { |
|
| 28 | 28 | header('429 Too Many Requests', 429); |
| 29 | - } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
| 29 | + } catch (\LunixREST\Exceptions\InvalidResponseFormatException $e) { |
|
| 30 | 30 | header('500 Internal Server Error', 500); |
| 31 | - } catch(Exception $e){ |
|
| 31 | + } catch (Exception $e) { |
|
| 32 | 32 | header('500 Internal Server Error', 500); |
| 33 | 33 | } |
| 34 | -} catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
|
| 34 | +} catch (\LunixREST\Exceptions\InvalidRequestFormatException $e) { |
|
| 35 | 35 | header('400 Bad Request', 400); |
| 36 | -} catch(Exception $e){ |
|
| 36 | +} catch (Exception $e) { |
|
| 37 | 37 | header('500 Internal Server Error', 500); |
| 38 | 38 | } |
@@ -5,6 +5,6 @@ |
||
| 5 | 5 | |
| 6 | 6 | class helloworld extends Endpoint { |
| 7 | 7 | public function getAll(){ |
| 8 | - return ["helloworld" => "hello world"]; |
|
| 9 | - } |
|
| 8 | + return ["helloworld" => "hello world"]; |
|
| 9 | + } |
|
| 10 | 10 | } |
| 11 | 11 | \ No newline at end of file |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | use LunixREST\Endpoints\Endpoint; |
| 5 | 5 | |
| 6 | 6 | class helloworld extends Endpoint { |
| 7 | - public function getAll(){ |
|
| 7 | + public function getAll() { |
|
| 8 | 8 | return ["helloworld" => "hello world"]; |
| 9 | 9 | } |
| 10 | 10 | } |
| 11 | 11 | \ No newline at end of file |
@@ -9,27 +9,27 @@ |
||
| 9 | 9 | $router = new \LunixREST\Router\Router($accessControl, $throttle, $formatsConfig, "HelloWorld"); |
| 10 | 10 | |
| 11 | 11 | try { |
| 12 | - $request = new \LunixREST\Request\Request("GET", [], [], '127.0.0.1', "/1.0/public/helloworld.json");//new \LunixREST\Request\Request($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
| 12 | + $request = new \LunixREST\Request\Request("GET", [], [], '127.0.0.1', "/1.0/public/helloworld.json");//new \LunixREST\Request\Request($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
| 13 | 13 | |
| 14 | - try { |
|
| 15 | - echo $router->handle($request); |
|
| 16 | - } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
|
| 17 | - header('400 Bad Request', 400); |
|
| 18 | - } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
| 19 | - header('404 Not Found', 404); |
|
| 20 | - } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
| 21 | - header('404 Not Found', 404); |
|
| 22 | - } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
| 23 | - header('403 Access Denied', 403); |
|
| 24 | - } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
| 25 | - header('429 Too Many Requests', 429); |
|
| 26 | - } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
| 27 | - header('500 Internal Server Error', 500); |
|
| 28 | - } catch(Exception $e){ |
|
| 29 | - header('500 Internal Server Error', 500); |
|
| 30 | - } |
|
| 14 | + try { |
|
| 15 | + echo $router->handle($request); |
|
| 16 | + } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
|
| 17 | + header('400 Bad Request', 400); |
|
| 18 | + } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
| 19 | + header('404 Not Found', 404); |
|
| 20 | + } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
| 21 | + header('404 Not Found', 404); |
|
| 22 | + } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
| 23 | + header('403 Access Denied', 403); |
|
| 24 | + } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
| 25 | + header('429 Too Many Requests', 429); |
|
| 26 | + } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
| 27 | + header('500 Internal Server Error', 500); |
|
| 28 | + } catch(Exception $e){ |
|
| 29 | + header('500 Internal Server Error', 500); |
|
| 30 | + } |
|
| 31 | 31 | } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
| 32 | - header('400 Bad Request', 400); |
|
| 32 | + header('400 Bad Request', 400); |
|
| 33 | 33 | } catch(Exception $e){ |
| 34 | - header('500 Internal Server Error', 500); |
|
| 34 | + header('500 Internal Server Error', 500); |
|
| 35 | 35 | } |
@@ -9,27 +9,27 @@ |
||
| 9 | 9 | $router = new \LunixREST\Router\Router($accessControl, $throttle, $formatsConfig, "HelloWorld"); |
| 10 | 10 | |
| 11 | 11 | try { |
| 12 | - $request = new \LunixREST\Request\Request("GET", [], [], '127.0.0.1', "/1.0/public/helloworld.json");//new \LunixREST\Request\Request($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
| 12 | + $request = new \LunixREST\Request\Request("GET", [], [], '127.0.0.1', "/1.0/public/helloworld.json"); //new \LunixREST\Request\Request($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']); |
|
| 13 | 13 | |
| 14 | 14 | try { |
| 15 | 15 | echo $router->handle($request); |
| 16 | - } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
|
| 16 | + } catch (\LunixREST\Exceptions\InvalidRequestFormatException $e) { |
|
| 17 | 17 | header('400 Bad Request', 400); |
| 18 | - } catch(\LunixREST\Exceptions\UnknownEndpointException $e){ |
|
| 18 | + } catch (\LunixREST\Exceptions\UnknownEndpointException $e) { |
|
| 19 | 19 | header('404 Not Found', 404); |
| 20 | - } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){ |
|
| 20 | + } catch (\LunixREST\Exceptions\UnknownResponseFormatException $e) { |
|
| 21 | 21 | header('404 Not Found', 404); |
| 22 | - } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
|
| 22 | + } catch (\LunixREST\Exceptions\AccessDeniedException $e) { |
|
| 23 | 23 | header('403 Access Denied', 403); |
| 24 | - } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
| 24 | + } catch (\LunixREST\Exceptions\ThrottleLimitExceededException $e) { |
|
| 25 | 25 | header('429 Too Many Requests', 429); |
| 26 | - } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
|
| 26 | + } catch (\LunixREST\Exceptions\InvalidResponseFormatException $e) { |
|
| 27 | 27 | header('500 Internal Server Error', 500); |
| 28 | - } catch(Exception $e){ |
|
| 28 | + } catch (Exception $e) { |
|
| 29 | 29 | header('500 Internal Server Error', 500); |
| 30 | 30 | } |
| 31 | -} catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){ |
|
| 31 | +} catch (\LunixREST\Exceptions\InvalidRequestFormatException $e) { |
|
| 32 | 32 | header('400 Bad Request', 400); |
| 33 | -} catch(Exception $e){ |
|
| 33 | +} catch (Exception $e) { |
|
| 34 | 34 | header('500 Internal Server Error', 500); |
| 35 | 35 | } |
@@ -21,7 +21,7 @@ |
||
| 21 | 21 | header('404 Not Found', 404); |
| 22 | 22 | } catch(\LunixREST\Exceptions\AccessDeniedException $e){ |
| 23 | 23 | header('403 Access Denied', 403); |
| 24 | - } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
| 24 | + } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){ |
|
| 25 | 25 | header('429 Too Many Requests', 429); |
| 26 | 26 | } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){ |
| 27 | 27 | header('500 Internal Server Error', 500); |