@@ -20,7 +20,7 @@ |
||
| 20 | 20 | * @throws UnknownEndpointException |
| 21 | 21 | */ |
| 22 | 22 | public function getEndpoint(string $name, string $version): Endpoint { |
| 23 | - $className = $this->buildVersionedEndpointNamespace($version) . $name; |
|
| 23 | + $className = $this->buildVersionedEndpointNamespace($version).$name; |
|
| 24 | 24 | return new $className($this->entityManager); |
| 25 | 25 | } |
| 26 | 26 | } |
@@ -25,7 +25,7 @@ discard block |
||
| 25 | 25 | */ |
| 26 | 26 | public function getEndpoint(string $name, string $version): Endpoint |
| 27 | 27 | { |
| 28 | - $className = $this->buildVersionedEndpointNamespace($version) . $name; |
|
| 28 | + $className = $this->buildVersionedEndpointNamespace($version).$name; |
|
| 29 | 29 | if (!class_exists($className)) { |
| 30 | 30 | throw new UnknownEndpointException("Could not find $className"); |
| 31 | 31 | } |
@@ -54,6 +54,6 @@ discard block |
||
| 54 | 54 | |
| 55 | 55 | protected function buildVersionedEndpointNamespace(string $version): string |
| 56 | 56 | { |
| 57 | - return $this->endpointNamespace . '\v' . str_replace('.', '_', $version) . '\\'; |
|
| 57 | + return $this->endpointNamespace.'\v'.str_replace('.', '_', $version).'\\'; |
|
| 58 | 58 | } |
| 59 | 59 | } |
@@ -40,10 +40,10 @@ |
||
| 40 | 40 | public function get($key) |
| 41 | 41 | { |
| 42 | 42 | //TODO: Cache the file contents |
| 43 | - $config = parse_ini_file($this->filename, (bool)$this->nameSpace); |
|
| 43 | + $config = parse_ini_file($this->filename, (bool) $this->nameSpace); |
|
| 44 | 44 | |
| 45 | 45 | if ($config === false) { |
| 46 | - throw new INIParseException('Could not parse: ' . $this->filename, true); |
|
| 46 | + throw new INIParseException('Could not parse: '.$this->filename, true); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | if ($this->nameSpace) { |
@@ -55,10 +55,10 @@ |
||
| 55 | 55 | public function __construct( |
| 56 | 56 | string $method, |
| 57 | 57 | string $endpoint, |
| 58 | - ?string $element, |
|
| 58 | + ? string $element, |
|
| 59 | 59 | array $acceptableMIMETypes, |
| 60 | - ?string $version, |
|
| 61 | - ?string $apiKey, |
|
| 60 | + ? string $version, |
|
| 61 | + ? string $apiKey, |
|
| 62 | 62 | array $queryData, |
| 63 | 63 | $data |
| 64 | 64 | ) { |
@@ -47,13 +47,13 @@ |
||
| 47 | 47 | $parsedHeaders = $this->headerParser->parse($serverRequest->getHeaders()); |
| 48 | 48 | |
| 49 | 49 | $urlQueryData = []; |
| 50 | - if($urlQueryString = $parsedURL->getQueryString()) |
|
| 50 | + if ($urlQueryString = $parsedURL->getQueryString()) |
|
| 51 | 51 | { |
| 52 | 52 | parse_str($parsedURL->getQueryString(), $urlQueryData); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | $apiKey = $parsedURL->getAPIKey(); |
| 56 | - if($apiKey === null) |
|
| 56 | + if ($apiKey === null) |
|
| 57 | 57 | { |
| 58 | 58 | $apiKey = $parsedHeaders->getAPIKey(); |
| 59 | 59 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * @param array $acceptableMIMETypes |
| 38 | 38 | * @param null|string $queryString |
| 39 | 39 | */ |
| 40 | - public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString) |
|
| 40 | + public function __construct(string $endpoint, ? string $element, ? string $version, ? string $apiKey, array $acceptableMIMETypes, ? string $queryString) |
|
| 41 | 41 | { |
| 42 | 42 | $this->endpoint = $endpoint; |
| 43 | 43 | $this->element = $element; |
@@ -47,13 +47,13 @@ |
||
| 47 | 47 | { |
| 48 | 48 | $method = $this->mapEndpointMethod($request); |
| 49 | 49 | if (!method_exists($endpoint, $method)) { |
| 50 | - throw new MethodNotFoundException("The endpoint method " . $method . " was not found"); |
|
| 50 | + throw new MethodNotFoundException("The endpoint method ".$method." was not found"); |
|
| 51 | 51 | } |
| 52 | 52 | return call_user_func([$endpoint, $method], $request); |
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | protected function mapEndpointMethod(APIRequest $request): string |
| 56 | 56 | { |
| 57 | - return strtolower($request->getMethod()) . ($request->getElement() ? 'All': ''); |
|
| 57 | + return strtolower($request->getMethod()).($request->getElement() ? 'All' : ''); |
|
| 58 | 58 | } |
| 59 | 59 | } |
@@ -90,7 +90,7 @@ |
||
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | $body = $response->getBody(); |
| 93 | - while(!$body->eof()) { |
|
| 93 | + while (!$body->eof()) { |
|
| 94 | 94 | echo $body->read(1024); |
| 95 | 95 | } |
| 96 | 96 | } |