Completed
Push — master ( 032cff...77091c )
by John
01:55
created
examples/helloworld/src/Endpoints/v1_0/helloworld.php 1 patch
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -17,5 +17,5 @@
 block discarded – undo
17 17
         $helloWorld = new \HelloWorld\Models\HelloWorld();
18 18
 
19 19
         return $helloWorld;
20
-	}
20
+    }
21 21
 }
Please login to merge, or discard this patch.
examples/geophone/src/EndpointFactory/EndpointFactory.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
      * @throws UnknownEndpointException
22 22
      */
23 23
     public function getEndpoint(string $name, string $version): Endpoint {
24
-        switch($version) {
24
+        switch ($version) {
25 25
             case "1":
26 26
                 switch (strtolower($name)) {
27 27
                     case "phonenumbers":
Please login to merge, or discard this patch.
examples/geophone/src/Endpoints/v1/PhoneNumbers.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,6 +20,6 @@
 block discarded – undo
20 20
 
21 21
 
22 22
     public function get(Request $request): ResponseData{
23
-		return $this->geoPhone->lookupNumber($request->getInstance());
24
-	}
23
+        return $this->geoPhone->lookupNumber($request->getInstance());
24
+    }
25 25
 }
Please login to merge, or discard this patch.
examples/geophone/src/Models/GeoPhone.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
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
 
@@ -29,7 +29,7 @@  discard block
 block discarded – undo
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 new LookupResponse($data[2], $data[3]);
34 34
             }
35 35
         }
Please login to merge, or discard this patch.
src/Endpoint/NamespaceEndpointFactory.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,8 +22,8 @@  discard block
 block discarded – undo
22 22
      * @throws UnknownEndpointException
23 23
      */
24 24
     public function getEndpoint(string $name, string $version): Endpoint {
25
-        $className = $this->buildVersionedEndpointNamespace($version) . $name;
26
-        if(!class_exists($className)){
25
+        $className = $this->buildVersionedEndpointNamespace($version).$name;
26
+        if (!class_exists($className)) {
27 27
             throw new UnknownEndpointException("Could not find $className");
28 28
         }
29 29
 
@@ -39,7 +39,7 @@  discard block
 block discarded – undo
39 39
         $classesInNamespace = [];
40 40
 
41 41
         $namespace = $this->buildVersionedEndpointNamespace($version);
42
-        foreach(get_declared_classes() as $name) {
42
+        foreach (get_declared_classes() as $name) {
43 43
             if (strpos($name, $namespace) === 0) {
44 44
                 $classesInNamespace[] = $name;
45 45
             }
@@ -49,6 +49,6 @@  discard block
 block discarded – undo
49 49
     }
50 50
 
51 51
     protected function buildVersionedEndpointNamespace(string $version): string {
52
-        return $this->endpointNamespace . '\v' . str_replace('.', '_', $version) . '\\';
52
+        return $this->endpointNamespace.'\v'.str_replace('.', '_', $version).'\\';
53 53
     }
54 54
 }
Please login to merge, or discard this patch.
src/Request/URLParser/BasicURLParser.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,7 +14,7 @@  discard block
 block discarded – undo
14 14
      */
15 15
     public function parse(string $url): ParsedURL {
16 16
         $splitURL = explode('/', trim($url, '/'));
17
-        if(count($splitURL) < 3){
17
+        if (count($splitURL) < 3) {
18 18
             throw new InvalidRequestURLException();
19 19
         }
20 20
         //Find endpoint
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
 
28 28
         $instance = null;
29 29
 
30
-        if(count($splitURL) == 4){
30
+        if (count($splitURL) == 4) {
31 31
             $instance = implode('.', $splitExtension);
32 32
         } else {
33 33
             $endpoint = implode('.', $splitExtension);
Please login to merge, or discard this patch.
src/Request/Request.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -62,7 +62,7 @@  discard block
 block discarded – undo
62 62
      * @param string $extension
63 63
      * @param string $instance
64 64
      */
65
-    public function __construct($method, array $headers, RequestData $body, RequestData $urlData, $ip, $version, $apiKey, $endpoint, $extension, $instance = null){
65
+    public function __construct($method, array $headers, RequestData $body, RequestData $urlData, $ip, $version, $apiKey, $endpoint, $extension, $instance = null) {
66 66
         $this->method = strtolower($method);
67 67
         $this->headers = $headers;
68 68
         $this->body = $body;
@@ -86,7 +86,7 @@  discard block
 block discarded – undo
86 86
      * @return string
87 87
      */
88 88
     public function getMethod() {
89
-        return $this->method . ($this->instance ? '' : 'All');
89
+        return $this->method.($this->instance ? '' : 'All');
90 90
     }
91 91
 
92 92
     /**
Please login to merge, or discard this patch.
src/Server/Router.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Server/HTTPServer.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -37,22 +37,22 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.