@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /** |
22 | 22 | * @param EndpointFactory $endpointFactory |
23 | 23 | */ |
24 | - public function __construct(EndpointFactory $endpointFactory){ |
|
24 | + public function __construct(EndpointFactory $endpointFactory) { |
|
25 | 25 | $this->endpointFactory = $endpointFactory; |
26 | 26 | } |
27 | 27 | |
@@ -43,8 +43,8 @@ discard block |
||
43 | 43 | * @throws MethodNotFoundException |
44 | 44 | */ |
45 | 45 | protected function executeEndpoint(Endpoint $endpoint, Request $request): ResponseData { |
46 | - if(!method_exists($endpoint, $request->getMethod())){ |
|
47 | - throw new MethodNotFoundException("The endpoint method " . $request->getMethod() . " was not found"); |
|
46 | + if (!method_exists($endpoint, $request->getMethod())) { |
|
47 | + throw new MethodNotFoundException("The endpoint method ".$request->getMethod()." was not found"); |
|
48 | 48 | } |
49 | 49 | return call_user_func([$endpoint, $request->getMethod()], $request); |
50 | 50 | } |
@@ -37,22 +37,22 @@ |
||
37 | 37 | try { |
38 | 38 | $response = $this->server->handleRequest($request); |
39 | 39 | echo $response->getAsString(); |
40 | - } catch(InvalidAPIKeyException $e){ |
|
40 | + } catch (InvalidAPIKeyException $e) { |
|
41 | 41 | header('400 Bad Request', true, 400); |
42 | - } catch(UnknownEndpointException $e){ |
|
42 | + } catch (UnknownEndpointException $e) { |
|
43 | 43 | header('404 Not Found', true, 404); |
44 | - } catch(UnknownResponseTypeException $e){ |
|
44 | + } catch (UnknownResponseTypeException $e) { |
|
45 | 45 | header('404 Not Found', true, 404); |
46 | - } catch(AccessDeniedException $e){ |
|
46 | + } catch (AccessDeniedException $e) { |
|
47 | 47 | header('403 Access Denied', true, 403); |
48 | - } catch(ThrottleLimitExceededException $e){ |
|
48 | + } catch (ThrottleLimitExceededException $e) { |
|
49 | 49 | header('429 Too Many Requests', true, 429); |
50 | 50 | } catch (\Exception $e) { |
51 | 51 | header('500 Internal Server Error', true, 500); |
52 | 52 | } |
53 | - } catch(InvalidRequestURLException $e){ |
|
53 | + } catch (InvalidRequestURLException $e) { |
|
54 | 54 | header('400 Bad Request', true, 400); |
55 | - } catch(\Exception $e){ |
|
55 | + } catch (\Exception $e) { |
|
56 | 56 | header('500 Internal Server Error', true, 500); |
57 | 57 | } |
58 | 58 | } |