Completed
Push — master ( 846411...c8b313 )
by John
01:51
created
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.
src/Request/URLParser/BasicURLParser.php 1 patch
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,7 +28,7 @@  discard block
 block discarded – undo
28 28
      */
29 29
     public function parse(string $url): ParsedURL {
30 30
         $splitURL = explode('/', trim($url, '/'));
31
-        if(count($splitURL) < 3){
31
+        if(count($splitURL) < 3) {
32 32
             throw new InvalidRequestURLException();
33 33
         }
34 34
         //Find endpoint
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 
42 42
         $instance = null;
43 43
 
44
-        if(count($splitURL) == 4){
44
+        if(count($splitURL) == 4) {
45 45
             $instance = implode('.', $splitExtension);
46 46
         } else {
47 47
             $endpoint = implode('.', $splitExtension);
Please login to merge, or discard this patch.
src/Request/MIMEFileProvider.php 1 patch
Braces   +10 added lines, -7 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@  discard block
 block discarded – undo
13 13
 
14 14
     //Borrowed from http://stackoverflow.com/a/1147952
15 15
     public function getAll(): array {
16
-        if($this->cache){
16
+        if($this->cache) {
17 17
             return $this->cache;
18 18
         }
19 19
 
@@ -21,14 +21,17 @@  discard block
 block discarded – undo
21 21
         $out = array();
22 22
         while(($line = fgets($this->file)) !== false) {
23 23
             $line = trim(preg_replace('/#.*/', '', $line));
24
-            if(!$line)
25
-                continue;
24
+            if(!$line) {
25
+                            continue;
26
+            }
26 27
             $parts = preg_split('/\s+/', $line);
27
-            if(count($parts) == 1)
28
-                continue;
28
+            if(count($parts) == 1) {
29
+                            continue;
30
+            }
29 31
             $type = array_shift($parts);
30
-            foreach($parts as $part)
31
-                $out[$part] = $type;
32
+            foreach($parts as $part) {
33
+                            $out[$part] = $type;
34
+            }
32 35
         }
33 36
 
34 37
         $this->cache = $out;
Please login to merge, or discard this patch.
src/Request/HeaderParser/BasicHeaderParser.php 1 patch
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -17,11 +17,11 @@  discard block
 block discarded – undo
17 17
         //TODO: follow RFC2616 order
18 18
         $acceptedMIMETypes = [];
19 19
         foreach($headers as $key => $value) {
20
-            if(strtolower($key) == 'http-accept'){
20
+            if(strtolower($key) == 'http-accept') {
21 21
                 $values = explode(',', $value);
22 22
                 foreach($values as $acceptedType) {
23 23
                     $typeParts = explode(';', $acceptedType);
24
-                    if(count($typeParts) > 0 ){
24
+                    if(count($typeParts) > 0 ) {
25 25
                         $acceptedMIMETypes[] = trim($typeParts);
26 26
                     }
27 27
                 }
@@ -31,18 +31,18 @@  discard block
 block discarded – undo
31 31
         return $acceptedMIMETypes;
32 32
     }
33 33
 
34
-    public function findAPIKey(array $headers){
34
+    public function findAPIKey(array $headers) {
35 35
         foreach($headers as $key => $value) {
36
-            if(strtolower($key) == $this->apiKeyHeaderKey){
36
+            if(strtolower($key) == $this->apiKeyHeaderKey) {
37 37
                 return $value;
38 38
             }
39 39
         }
40 40
         return null;
41 41
     }
42 42
 
43
-    public function getContentType(array $headers){
43
+    public function getContentType(array $headers) {
44 44
         foreach($headers as $key => $value) {
45
-            if(strtolower($key) == 'content-type'){
45
+            if(strtolower($key) == 'content-type') {
46 46
                 return $value;
47 47
             }
48 48
         }
Please login to merge, or discard this patch.
src/Request/Request.php 1 patch
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -64,7 +64,7 @@
 block discarded – undo
64 64
      * @internal param string $extension
65 65
      */
66 66
 
67
-    public function __construct($method, array $headers, RequestData $body, RequestData $urlData, $ip, $version, $apiKey, $endpoint, array $acceptableMIMETypes = [], $instance = null){
67
+    public function __construct($method, array $headers, RequestData $body, RequestData $urlData, $ip, $version, $apiKey, $endpoint, array $acceptableMIMETypes = [], $instance = null) {
68 68
         $this->method = strtolower($method);
69 69
         $this->headers = $headers;
70 70
         $this->body = $body;
Please login to merge, or discard this patch.