Completed
Branch version2 (a24b39)
by John
03:03
created
src/Configuration/INIConfiguration.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
         $this->config = parse_ini_file($filename, true);
25 25
 
26 26
         if ($this->config === false) {
27
-            throw new INIParseException('Could not parse: ' . $filename, true);
27
+            throw new INIParseException('Could not parse: '.$filename, true);
28 28
         }
29 29
     }
30 30
 
Please login to merge, or discard this patch.
src/Server/Throttle/CachePoolThrottle.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -57,7 +57,7 @@
 block discarded – undo
57 57
     {
58 58
         $item = $this->cacheItemPool->getItem($this->deriveCacheKey($request));
59 59
 
60
-        if($requestCount = $item->get()) {
60
+        if ($requestCount = $item->get()) {
61 61
             $item->set($requestCount + 1);
62 62
         } else {
63 63
             $item->set(1)->expiresAfter($this->perXSeconds);
Please login to merge, or discard this patch.
src/Server/Throttle/APIKeyCachePoolThrottle.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,6 +30,6 @@
 block discarded – undo
30 30
      */
31 31
     protected function deriveCacheKey(APIRequest $request): string
32 32
     {
33
-        return $this->keyPrefix . $request->getApiKey();
33
+        return $this->keyPrefix.$request->getApiKey();
34 34
     }
35 35
 }
Please login to merge, or discard this patch.
src/Server/Router/EndpointFactory/RegisteredEndpointFactory.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
      */
23 23
     public function register(string $name, string $version, Endpoint $endpoint)
24 24
     {
25
-        if(!isset($this->endpoints[$version])) {
25
+        if (!isset($this->endpoints[$version])) {
26 26
             $this->endpoints[$version] = [];
27 27
         }
28 28
         $this->endpoints[$version][strtolower($name)] = $endpoint;
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
     public function getEndpoint(string $name, string $version): Endpoint
38 38
     {
39 39
         $lowercaseName = strtolower($name);
40
-        if(!isset($this->endpoints[$version]) || !isset($this->endpoints[$version][$lowercaseName])) {
41
-            throw new UnknownEndpointException('Could not find endpoint: ' . $name . ' of version: ' . $version);
40
+        if (!isset($this->endpoints[$version]) || !isset($this->endpoints[$version][$lowercaseName])) {
41
+            throw new UnknownEndpointException('Could not find endpoint: '.$name.' of version: '.$version);
42 42
         }
43 43
 
44 44
         return $this->endpoints[$version][$lowercaseName];
Please login to merge, or discard this patch.
src/Server/Router/GenericRouter.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
     {
59 59
         $method = $this->mapEndpointMethod($request);
60 60
         if (!method_exists($endpoint, $method)) {
61
-            throw new MethodNotFoundException("The endpoint method " . $method . " was not found");
61
+            throw new MethodNotFoundException("The endpoint method ".$method." was not found");
62 62
         }
63 63
         return call_user_func([$endpoint, $method], $request);
64 64
     }
@@ -69,6 +69,6 @@  discard block
 block discarded – undo
69 69
      */
70 70
     protected function mapEndpointMethod(APIRequest $request): string
71 71
     {
72
-        return strtolower($request->getMethod()) . (!$request->getElement() ? 'All': '');
72
+        return strtolower($request->getMethod()).(!$request->getElement() ? 'All' : '');
73 73
     }
74 74
 }
Please login to merge, or discard this patch.
src/Server/APIRequest/APIRequest.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
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
     ) {
@@ -91,7 +91,7 @@  discard block
 block discarded – undo
91 91
     /**
92 92
      * @return null|string
93 93
      */
94
-    public function getElement(): ?string
94
+    public function getElement(): ? string
95 95
     {
96 96
         return $this->element;
97 97
     }
@@ -107,7 +107,7 @@  discard block
 block discarded – undo
107 107
     /**
108 108
      * @return null|string
109 109
      */
110
-    public function getVersion(): ?string
110
+    public function getVersion(): ? string
111 111
     {
112 112
         return $this->version;
113 113
     }
@@ -115,7 +115,7 @@  discard block
 block discarded – undo
115 115
     /**
116 116
      * @return null|string
117 117
      */
118
-    public function getApiKey(): ?string
118
+    public function getApiKey(): ? string
119 119
     {
120 120
         return $this->apiKey;
121 121
     }
Please login to merge, or discard this patch.
src/Server/ResponseFactory/RegisteredResponseFactory.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
      */
21 21
     public function __construct($responseTypes = [])
22 22
     {
23
-        foreach($responseTypes as $mimeType => $serializer) {
23
+        foreach ($responseTypes as $mimeType => $serializer) {
24 24
             $this->registerSerializer($mimeType, $serializer);
25 25
         }
26 26
     }
@@ -43,7 +43,7 @@  discard block
 block discarded – undo
43 43
         }
44 44
 
45 45
         foreach ($acceptedMIMETypes as $acceptedMIMEType) {
46
-            if(isset($this->serializers[strtolower($acceptedMIMEType)])) {
46
+            if (isset($this->serializers[strtolower($acceptedMIMEType)])) {
47 47
                 return new APIResponse($acceptedMIMEType, $this->serializers[strtolower($acceptedMIMEType)]->serialize($data));
48 48
             }
49 49
         }
Please login to merge, or discard this patch.
src/RequestFactory/URLParser/ParsedURL.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
      * @param array $acceptableMIMETypes
43 43
      * @param null|string $queryString
44 44
      */
45
-    public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString)
45
+    public function __construct(string $endpoint, ? string $element, ? string $version, ? string $apiKey, array $acceptableMIMETypes, ? string $queryString)
46 46
     {
47 47
         $this->endpoint = $endpoint;
48 48
         $this->element = $element;
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     /**
64 64
      * @return null|string
65 65
      */
66
-    public function getElement(): ?string
66
+    public function getElement(): ? string
67 67
     {
68 68
         return $this->element;
69 69
     }
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
     /**
72 72
      * @return null|string
73 73
      */
74
-    public function getVersion(): ?string
74
+    public function getVersion(): ? string
75 75
     {
76 76
         return $this->version;
77 77
     }
@@ -79,7 +79,7 @@  discard block
 block discarded – undo
79 79
     /**
80 80
      * @return null|string
81 81
      */
82
-    public function getApiKey(): ?string
82
+    public function getApiKey(): ? string
83 83
     {
84 84
         return $this->apiKey;
85 85
     }
Please login to merge, or discard this patch.
src/RequestFactory/URLParser/RegexURLParser/RegexURLParser.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -32,11 +32,11 @@  discard block
 block discarded – undo
32 32
      * @param MIMEProvider|null $MIMEProvider
33 33
      * @throws InvalidRegexPatternException
34 34
      */
35
-    public function __construct(string $pattern, ?MIMEProvider $MIMEProvider = null)
35
+    public function __construct(string $pattern, ? MIMEProvider $MIMEProvider = null)
36 36
     {
37 37
         $this->pattern = $pattern;
38 38
 
39
-        if(@preg_match($pattern, null) === false) {
39
+        if (@preg_match($pattern, null) === false) {
40 40
             throw new InvalidRegexPatternException("Unable to parse regex pattern", preg_last_error());
41 41
         }
42 42
         $this->MIMEProvider = $MIMEProvider;
@@ -51,10 +51,10 @@  discard block
 block discarded – undo
51 51
     public function parse(UriInterface $uri): ParsedURL
52 52
     {
53 53
         $matches = [];
54
-        if(preg_match($this->pattern, $uri->getPath(), $matches) === 0) {
54
+        if (preg_match($this->pattern, $uri->getPath(), $matches) === 0) {
55 55
             throw new InvalidRequestURLException("Unable to parse request path: did not match regex");
56 56
         }
57
-        if(!($endpoint = $matches["endpoint"] ?? null)) {
57
+        if (!($endpoint = $matches["endpoint"] ?? null)) {
58 58
             throw new InvalidRequestURLException("Unable to match endpoint in url");
59 59
         }
60 60
         $element = $matches["element"] ?? null;
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
         $apiKey = $matches["apiKey"] ?? null;
63 63
 
64 64
         $acceptableMimeTypes = [];
65
-        if(($acceptableExtension = $matches["acceptableExtension"] ?? null)) {
66
-            if(!$this->MIMEProvider) {
65
+        if (($acceptableExtension = $matches["acceptableExtension"] ?? null)) {
66
+            if (!$this->MIMEProvider) {
67 67
                 throw new InvalidRequestURLException("Unable to accept acceptable extensions");
68 68
             } else {
69 69
                 try {
Please login to merge, or discard this patch.