Completed
Push — master ( bff359...005b00 )
by John
01:53
created
examples/geophone/src/Models/GeoPhone.php 1 patch
Braces   +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/Server/Router.php 1 patch
Braces   +2 added lines, -2 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,7 +43,7 @@  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())){
46
+        if(!method_exists($endpoint, $request->getMethod())) {
47 47
             throw new MethodNotFoundException("The endpoint method " . $request->getMethod() . " was not found");
48 48
         }
49 49
         return call_user_func([$endpoint, $request->getMethod()], $request);
Please login to merge, or discard this patch.
src/Server/Server.php 1 patch
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Server/HTTPServer.php 1 patch
Braces   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -42,26 +42,26 @@
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/Endpoint/NamespaceEndpointFactory.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@
 block discarded – undo
23 23
      */
24 24
     public function getEndpoint(string $name, string $version): Endpoint {
25 25
         $className = $this->buildVersionedEndpointNamespace($version) . $name;
26
-        if(!class_exists($className)){
26
+        if(!class_exists($className)) {
27 27
             throw new UnknownEndpointException("Could not find $className");
28 28
         }
29 29
 
Please login to merge, or discard this patch.
src/Endpoint/DoctrineEndpoint.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -9,7 +9,7 @@
 block discarded – undo
9 9
 class DoctrineEndpoint extends DefaultEndpoint {
10 10
     protected $entityManager;
11 11
 
12
-    public function __construct(EntityManager $em){
12
+    public function __construct(EntityManager $em) {
13 13
         $this->entityManager = $em;
14 14
     }
15 15
 }
Please login to merge, or discard this patch.
src/AccessControl/MultiAndAccessControl.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -11,9 +11,9 @@  discard block
 block discarded – undo
11 11
      * @param \LunixREST\Request\Request $request
12 12
      * @return bool true if all of the $accessControls' validate access methods returned true for the given request
13 13
      */
14
-    public function validateAccess(Request $request){
15
-        foreach($this->accessControls as $accessControl){
16
-            if(!$accessControl->validateAccess($request)){
14
+    public function validateAccess(Request $request) {
15
+        foreach($this->accessControls as $accessControl) {
16
+            if(!$accessControl->validateAccess($request)) {
17 17
                 return false;
18 18
             }
19 19
         }
@@ -24,9 +24,9 @@  discard block
 block discarded – undo
24 24
      * @param $apiKey
25 25
      * @return bool true if all of the $accessControls' validate key methods returned true for the given request
26 26
      */
27
-    public function validateKey($apiKey){
28
-        foreach($this->accessControls as $accessControl){
29
-            if(!$accessControl->validateKey($apiKey)){
27
+    public function validateKey($apiKey) {
28
+        foreach($this->accessControls as $accessControl) {
29
+            if(!$accessControl->validateKey($apiKey)) {
30 30
                 return false;
31 31
             }
32 32
         }
Please login to merge, or discard this patch.
src/Response/DefaultResponseFactory.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@
 block discarded – undo
11 11
      * @throws NotAcceptableResponseTypeException
12 12
      */
13 13
     public function getResponse(ResponseData $data, array $acceptedMIMETypes): Response {
14
-        if(empty($acceptedMIMETypes)){
14
+        if(empty($acceptedMIMETypes)) {
15 15
             $acceptedMIMETypes = $this->getSupportedMIMETypes();
16 16
         }
17 17
 
Please login to merge, or discard this patch.
src/Configuration/INIConfiguration.php 1 patch
Braces   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 * @param string $filename
23 23
 	 * @param string $nameSpace
24 24
 	 */
25
-	public function __construct($filename, $nameSpace = null){
25
+	public function __construct($filename, $nameSpace = null) {
26 26
 		$this->filename = $filename;
27 27
 		$this->nameSpace = $nameSpace;
28 28
 	}
@@ -33,10 +33,10 @@  discard block
 block discarded – undo
33 33
 	 * @throws INIKeyNotFoundException
34 34
 	 * @throws INIParseException
35 35
 	 */
36
-	public function get($key){
36
+	public function get($key) {
37 37
 		$config = parse_ini_file($this->filename, (bool)$this->nameSpace);
38 38
 
39
-		if($config === false){
39
+		if($config === false) {
40 40
 			throw new INIParseException('Could not parse: ' . $this->filename, true);
41 41
 		}
42 42
 
@@ -54,7 +54,7 @@  discard block
 block discarded – undo
54 54
 	/**
55 55
 	 * @param $key
56 56
 	 */
57
-	public function set($key){
57
+	public function set($key) {
58 58
 		//TODO write this
59 59
 	}
60 60
 }
Please login to merge, or discard this patch.