Completed
Push — master ( bff359...005b00 )
by John
01:53
created
src/AccessControl/PublicAccessControl.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      * @param \LunixREST\Request\Request $request
12 12
      * @return bool
13 13
      */
14
-    public function validateAccess(Request $request){
14
+    public function validateAccess(Request $request) {
15 15
         return true;
16 16
     }
17 17
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      * @param $apiKey
20 20
      * @return bool
21 21
      */
22
-    public function validateKey($apiKey){
22
+    public function validateKey($apiKey) {
23 23
         return true;
24 24
     }
25 25
 }
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -11,7 +11,7 @@  discard block
 block discarded – undo
11 11
      * @param \LunixREST\Request\Request $request
12 12
      * @return bool
13 13
      */
14
-    public function validateAccess(Request $request){
14
+    public function validateAccess(Request $request) {
15 15
         return true;
16 16
     }
17 17
 
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
      * @param $apiKey
20 20
      * @return bool
21 21
      */
22
-    public function validateKey($apiKey){
22
+    public function validateKey($apiKey) {
23 23
         return true;
24 24
     }
25 25
 }
Please login to merge, or discard this patch.
src/AccessControl/OneKeyAccessControl.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @param string $key
17 17
      */
18
-    public function __construct($key){
18
+    public function __construct($key) {
19 19
         $this->key = $key;
20 20
     }
21 21
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param \LunixREST\Request\Request $request
24 24
      * @return bool true if key is valid
25 25
      */
26
-    public function validateAccess(Request $request){
26
+    public function validateAccess(Request $request) {
27 27
         return $this->validateKey($request->getApiKey());
28 28
     }
29 29
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @param $apiKey
32 32
      * @return bool true if key is the key specified in the constructor
33 33
      */
34
-    public function validateKey($apiKey){
34
+    public function validateKey($apiKey) {
35 35
         return $apiKey === $this->key;
36 36
     }
37 37
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@  discard block
 block discarded – undo
15 15
     /**
16 16
      * @param string $key
17 17
      */
18
-    public function __construct($key){
18
+    public function __construct($key) {
19 19
         $this->key = $key;
20 20
     }
21 21
 
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param \LunixREST\Request\Request $request
24 24
      * @return bool true if key is valid
25 25
      */
26
-    public function validateAccess(Request $request){
26
+    public function validateAccess(Request $request) {
27 27
         return $this->validateKey($request->getApiKey());
28 28
     }
29 29
 
@@ -31,7 +31,7 @@  discard block
 block discarded – undo
31 31
      * @param $apiKey
32 32
      * @return bool true if key is the key specified in the constructor
33 33
      */
34
-    public function validateKey($apiKey){
34
+    public function validateKey($apiKey) {
35 35
         return $apiKey === $this->key;
36 36
     }
37 37
 }
Please login to merge, or discard this patch.
src/Request/HeaderParser/BasicHeaderParser.php 2 patches
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -24,12 +24,12 @@  discard block
 block discarded – undo
24 24
     protected function findAcceptableMIMETypes(array $headers): array{
25 25
         //TODO: follow RFC2616 order
26 26
         $acceptedMIMETypes = [];
27
-        foreach($headers as $key => $value) {
28
-            if(strtolower($key) == 'http-accept'){
27
+        foreach ($headers as $key => $value) {
28
+            if (strtolower($key) == 'http-accept') {
29 29
                 $values = explode(',', $value);
30
-                foreach($values as $acceptedType) {
30
+                foreach ($values as $acceptedType) {
31 31
                     $typeParts = explode(';', $acceptedType);
32
-                    if(count($typeParts) > 0 ){
32
+                    if (count($typeParts) > 0) {
33 33
                         $acceptedMIMETypes[] = trim($typeParts[0]);
34 34
                     }
35 35
                 }
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
         return $acceptedMIMETypes;
40 40
     }
41 41
 
42
-    protected function findAPIKey(array $headers){
43
-        foreach($headers as $key => $value) {
44
-            if(strtolower($key) == strtolower($this->apiKeyHeaderKey)){
42
+    protected function findAPIKey(array $headers) {
43
+        foreach ($headers as $key => $value) {
44
+            if (strtolower($key) == strtolower($this->apiKeyHeaderKey)) {
45 45
                 return $value;
46 46
             }
47 47
         }
48 48
         return null;
49 49
     }
50 50
 
51
-    protected function getContentType(array $headers){
52
-        foreach($headers as $key => $value) {
53
-            if(strtolower($key) == 'content-type'){
51
+    protected function getContentType(array $headers) {
52
+        foreach ($headers as $key => $value) {
53
+            if (strtolower($key) == 'content-type') {
54 54
                 return $value;
55 55
             }
56 56
         }
Please login to merge, or discard this patch.
Braces   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -25,11 +25,11 @@  discard block
 block discarded – undo
25 25
         //TODO: follow RFC2616 order
26 26
         $acceptedMIMETypes = [];
27 27
         foreach($headers as $key => $value) {
28
-            if(strtolower($key) == 'http-accept'){
28
+            if(strtolower($key) == 'http-accept') {
29 29
                 $values = explode(',', $value);
30 30
                 foreach($values as $acceptedType) {
31 31
                     $typeParts = explode(';', $acceptedType);
32
-                    if(count($typeParts) > 0 ){
32
+                    if(count($typeParts) > 0 ) {
33 33
                         $acceptedMIMETypes[] = trim($typeParts[0]);
34 34
                     }
35 35
                 }
@@ -39,18 +39,18 @@  discard block
 block discarded – undo
39 39
         return $acceptedMIMETypes;
40 40
     }
41 41
 
42
-    protected function findAPIKey(array $headers){
42
+    protected function findAPIKey(array $headers) {
43 43
         foreach($headers as $key => $value) {
44
-            if(strtolower($key) == strtolower($this->apiKeyHeaderKey)){
44
+            if(strtolower($key) == strtolower($this->apiKeyHeaderKey)) {
45 45
                 return $value;
46 46
             }
47 47
         }
48 48
         return null;
49 49
     }
50 50
 
51
-    protected function getContentType(array $headers){
51
+    protected function getContentType(array $headers) {
52 52
         foreach($headers as $key => $value) {
53
-            if(strtolower($key) == 'content-type'){
53
+            if(strtolower($key) == 'content-type') {
54 54
                 return $value;
55 55
             }
56 56
         }
Please login to merge, or discard this patch.
src/Request/MIMEFileProvider.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -13,23 +13,23 @@
 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
 
20 20
         # Returns the system MIME type mapping of extensions to MIME types, as defined in /etc/mime.types.
21 21
         $out = array();
22
-        while(($line = fgets($this->file)) !== false) {
22
+        while (($line = fgets($this->file)) !== false) {
23 23
             $line = trim(preg_replace('/#.*/', '', $line));
24
-            if(!$line) {
24
+            if (!$line) {
25 25
                 continue;
26 26
             }
27 27
             $parts = preg_split('/\s+/', $line);
28
-            if(count($parts) == 1) {
28
+            if (count($parts) == 1) {
29 29
                 continue;
30 30
             }
31 31
             $type = array_shift($parts);
32
-            foreach($parts as $part) {
32
+            foreach ($parts as $part) {
33 33
                 $out[$part] = $type;
34 34
             }
35 35
         }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 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
 
Please login to merge, or discard this patch.
src/AccessControl/MultiAccessControl.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     /**
17 17
      * @param AccessControl[] $accessControls array of access controls
18 18
      */
19
-    public function __construct(array $accessControls){
19
+    public function __construct(array $accessControls) {
20 20
         $this->accessControls = $accessControls;
21 21
     }
22 22
 }
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -16,7 +16,7 @@
 block discarded – undo
16 16
     /**
17 17
      * @param AccessControl[] $accessControls array of access controls
18 18
      */
19
-    public function __construct(array $accessControls){
19
+    public function __construct(array $accessControls) {
20 20
         $this->accessControls = $accessControls;
21 21
     }
22 22
 }
Please login to merge, or discard this patch.
src/AccessControl/AllAccessConfigurationListAccessControl.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param Configuration $config a config that has a list of valid keys in the stored $configKey
24 24
      * @param string $configKey key to use when accessing the list of valid keys from the $config
25 25
      */
26
-    public function __construct(Configuration $config, $configKey = 'keys'){
26
+    public function __construct(Configuration $config, $configKey = 'keys') {
27 27
         $this->config = $config;
28 28
         $this->configKey = $configKey;
29 29
     }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      * @param \LunixREST\Request\Request $request
33 33
      * @return bool true if this key is valid
34 34
      */
35
-    public function validateAccess(Request $request){
35
+    public function validateAccess(Request $request) {
36 36
         return $this->validateKey($request->getApiKey());
37 37
     }
38 38
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param $apiKey
41 41
      * @return bool true if the key is found inside of the array returned by the config when $config->get is called with the key from the constructor
42 42
      */
43
-    public function validateKey($apiKey){
43
+    public function validateKey($apiKey) {
44 44
         return in_array($apiKey, $this->config->get($this->configKey));
45 45
     }
46 46
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
      * @param Configuration $config a config that has a list of valid keys in the stored $configKey
24 24
      * @param string $configKey key to use when accessing the list of valid keys from the $config
25 25
      */
26
-    public function __construct(Configuration $config, $configKey = 'keys'){
26
+    public function __construct(Configuration $config, $configKey = 'keys') {
27 27
         $this->config = $config;
28 28
         $this->configKey = $configKey;
29 29
     }
@@ -32,7 +32,7 @@  discard block
 block discarded – undo
32 32
      * @param \LunixREST\Request\Request $request
33 33
      * @return bool true if this key is valid
34 34
      */
35
-    public function validateAccess(Request $request){
35
+    public function validateAccess(Request $request) {
36 36
         return $this->validateKey($request->getApiKey());
37 37
     }
38 38
 
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
      * @param $apiKey
41 41
      * @return bool true if the key is found inside of the array returned by the config when $config->get is called with the key from the constructor
42 42
      */
43
-    public function validateKey($apiKey){
43
+    public function validateKey($apiKey) {
44 44
         return in_array($apiKey, $this->config->get($this->configKey));
45 45
     }
46 46
 }
Please login to merge, or discard this patch.