@@ -40,7 +40,7 @@ discard block |
||
40 | 40 | * @param ResponseFactory $responseFactory |
41 | 41 | * @param EndpointFactory $endpointFactory |
42 | 42 | */ |
43 | - public function __construct(AccessControl $accessControl, Throttle $throttle, ResponseFactory $responseFactory, EndpointFactory $endpointFactory){ |
|
43 | + public function __construct(AccessControl $accessControl, Throttle $throttle, ResponseFactory $responseFactory, EndpointFactory $endpointFactory) { |
|
44 | 44 | $this->accessControl = $accessControl; |
45 | 45 | $this->throttle = $throttle; |
46 | 46 | $this->responseFactory = $responseFactory; |
@@ -80,8 +80,8 @@ discard block |
||
80 | 80 | * @param Request $request |
81 | 81 | * @throws InvalidAPIKeyException |
82 | 82 | */ |
83 | - protected function validateKey(Request $request){ |
|
84 | - if(!$this->accessControl->validateKey($request->getApiKey())){ |
|
83 | + protected function validateKey(Request $request) { |
|
84 | + if(!$this->accessControl->validateKey($request->getApiKey())) { |
|
85 | 85 | throw new InvalidAPIKeyException('Invalid API key'); |
86 | 86 | } |
87 | 87 | } |
@@ -40,28 +40,28 @@ |
||
40 | 40 | |
41 | 41 | try { |
42 | 42 | $response = $this->server->handleRequest($request); |
43 | - header("Content-Type: " . $response->getMIMEType()); |
|
43 | + header("Content-Type: ".$response->getMIMEType()); |
|
44 | 44 | echo $response->getAsString(); |
45 | - } catch(InvalidAPIKeyException $e){ |
|
45 | + } catch (InvalidAPIKeyException $e) { |
|
46 | 46 | header('400 Bad Request', true, 400); |
47 | - } catch(UnknownEndpointException $e){ |
|
47 | + } catch (UnknownEndpointException $e) { |
|
48 | 48 | header('404 Not Found', true, 404); |
49 | - } catch(NotAcceptableResponseTypeException $e){ |
|
49 | + } catch (NotAcceptableResponseTypeException $e) { |
|
50 | 50 | header('406 Not Acceptable', true, 406); |
51 | - } catch(AccessDeniedException $e){ |
|
51 | + } catch (AccessDeniedException $e) { |
|
52 | 52 | header('403 Access Denied', true, 403); |
53 | - } catch(ThrottleLimitExceededException $e){ |
|
53 | + } catch (ThrottleLimitExceededException $e) { |
|
54 | 54 | header('429 Too Many Requests', true, 429); |
55 | 55 | } catch (\Exception $e) { |
56 | 56 | header('500 Internal Server Error', true, 500); |
57 | 57 | } |
58 | - } catch(InvalidRequestURLException $e){ |
|
58 | + } catch (InvalidRequestURLException $e) { |
|
59 | 59 | header('400 Bad Request', true, 400); |
60 | - } catch(UnknownContentTypeException $e){ |
|
60 | + } catch (UnknownContentTypeException $e) { |
|
61 | 61 | header('400 Bad Request', true, 400); |
62 | - } catch(InvalidRequestDataException $e){ |
|
62 | + } catch (InvalidRequestDataException $e) { |
|
63 | 63 | header('400 Bad Request', true, 400); |
64 | - } catch(\Exception $e){ |
|
64 | + } catch (\Exception $e) { |
|
65 | 65 | header('500 Internal Server Error', true, 500); |
66 | 66 | } |
67 | 67 | } |
@@ -42,26 +42,26 @@ |
||
42 | 42 | $response = $this->server->handleRequest($request); |
43 | 43 | header("Content-Type: " . $response->getMIMEType()); |
44 | 44 | echo $response->getAsString(); |
45 | - } catch(InvalidAPIKeyException $e){ |
|
45 | + } catch(InvalidAPIKeyException $e) { |
|
46 | 46 | header('400 Bad Request', true, 400); |
47 | - } catch(UnknownEndpointException $e){ |
|
47 | + } catch(UnknownEndpointException $e) { |
|
48 | 48 | header('404 Not Found', true, 404); |
49 | - } catch(NotAcceptableResponseTypeException $e){ |
|
49 | + } catch(NotAcceptableResponseTypeException $e) { |
|
50 | 50 | header('406 Not Acceptable', true, 406); |
51 | - } catch(AccessDeniedException $e){ |
|
51 | + } catch(AccessDeniedException $e) { |
|
52 | 52 | header('403 Access Denied', true, 403); |
53 | - } catch(ThrottleLimitExceededException $e){ |
|
53 | + } catch(ThrottleLimitExceededException $e) { |
|
54 | 54 | header('429 Too Many Requests', true, 429); |
55 | 55 | } catch (\Exception $e) { |
56 | 56 | header('500 Internal Server Error', true, 500); |
57 | 57 | } |
58 | - } catch(InvalidRequestURLException $e){ |
|
58 | + } catch(InvalidRequestURLException $e) { |
|
59 | 59 | header('400 Bad Request', true, 400); |
60 | - } catch(UnknownContentTypeException $e){ |
|
60 | + } catch(UnknownContentTypeException $e) { |
|
61 | 61 | header('400 Bad Request', true, 400); |
62 | - } catch(InvalidRequestDataException $e){ |
|
62 | + } catch(InvalidRequestDataException $e) { |
|
63 | 63 | header('400 Bad Request', true, 400); |
64 | - } catch(\Exception $e){ |
|
64 | + } catch(\Exception $e) { |
|
65 | 65 | header('500 Internal Server Error', true, 500); |
66 | 66 | } |
67 | 67 | } |