Completed
Push — master ( 53fccc...bff359 )
by John
02:02
created
src/Configuration/INIConfiguration.php 2 patches
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -10,54 +10,54 @@
 block discarded – undo
10 10
  * @package LunixREST\Configuration
11 11
  */
12 12
 class INIConfiguration implements Configuration {
13
-	/**
14
-	 * @var null
15
-	 */
16
-	protected $nameSpace;
17
-	/**
18
-	 * @var
19
-	 */
20
-	protected $filename;
21
-
22
-	/**
23
-	 * @param string $filename
24
-	 * @param string $nameSpace
25
-	 */
26
-	public function __construct($filename, $nameSpace = null){
27
-		$this->filename = $filename;
28
-		$this->nameSpace = $nameSpace;
29
-	}
30
-
31
-	/**
13
+    /**
14
+     * @var null
15
+     */
16
+    protected $nameSpace;
17
+    /**
18
+     * @var
19
+     */
20
+    protected $filename;
21
+
22
+    /**
23
+     * @param string $filename
24
+     * @param string $nameSpace
25
+     */
26
+    public function __construct($filename, $nameSpace = null){
27
+        $this->filename = $filename;
28
+        $this->nameSpace = $nameSpace;
29
+    }
30
+
31
+    /**
32 32
      * //TODO: Move throws/loading to constructor to keep with get contract
33
-	 * @param $key
34
-	 * @return mixed
35
-	 * @throws INIKeyNotFoundException
36
-	 * @throws INIParseException
37
-	 */
38
-	public function get($key){
39
-	    //TODO: Cache the file contents
40
-		$config = parse_ini_file($this->filename, (bool)$this->nameSpace);
41
-
42
-		if($config === false){
43
-			throw new INIParseException('Could not parse: ' . $this->filename, true);
44
-		}
45
-
46
-		if($this->nameSpace) {
47
-			if(isset($config[$this->nameSpace])) {
48
-				$config = $config[$this->nameSpace];
49
-			} else {
50
-				throw new INIKeyNotFoundException();
51
-			}
52
-		}
53
-
54
-		return isset($config[$key]) ? $config[$key] : null;
55
-	}
56
-
57
-	/**
58
-	 * @param $key
59
-	 */
60
-	public function set($key){
61
-		//TODO write this
62
-	}
33
+     * @param $key
34
+     * @return mixed
35
+     * @throws INIKeyNotFoundException
36
+     * @throws INIParseException
37
+     */
38
+    public function get($key){
39
+        //TODO: Cache the file contents
40
+        $config = parse_ini_file($this->filename, (bool)$this->nameSpace);
41
+
42
+        if($config === false){
43
+            throw new INIParseException('Could not parse: ' . $this->filename, true);
44
+        }
45
+
46
+        if($this->nameSpace) {
47
+            if(isset($config[$this->nameSpace])) {
48
+                $config = $config[$this->nameSpace];
49
+            } else {
50
+                throw new INIKeyNotFoundException();
51
+            }
52
+        }
53
+
54
+        return isset($config[$key]) ? $config[$key] : null;
55
+    }
56
+
57
+    /**
58
+     * @param $key
59
+     */
60
+    public function set($key){
61
+        //TODO write this
62
+    }
63 63
 }
Please login to merge, or discard this patch.
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -23,7 +23,7 @@  discard block
 block discarded – undo
23 23
 	 * @param string $filename
24 24
 	 * @param string $nameSpace
25 25
 	 */
26
-	public function __construct($filename, $nameSpace = null){
26
+	public function __construct($filename, $nameSpace = null) {
27 27
 		$this->filename = $filename;
28 28
 		$this->nameSpace = $nameSpace;
29 29
 	}
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 	 * @throws INIKeyNotFoundException
36 36
 	 * @throws INIParseException
37 37
 	 */
38
-	public function get($key){
38
+	public function get($key) {
39 39
 	    //TODO: Cache the file contents
40
-		$config = parse_ini_file($this->filename, (bool)$this->nameSpace);
40
+		$config = parse_ini_file($this->filename, (bool) $this->nameSpace);
41 41
 
42
-		if($config === false){
43
-			throw new INIParseException('Could not parse: ' . $this->filename, true);
42
+		if ($config === false) {
43
+			throw new INIParseException('Could not parse: '.$this->filename, true);
44 44
 		}
45 45
 
46
-		if($this->nameSpace) {
47
-			if(isset($config[$this->nameSpace])) {
46
+		if ($this->nameSpace) {
47
+			if (isset($config[$this->nameSpace])) {
48 48
 				$config = $config[$this->nameSpace];
49 49
 			} else {
50 50
 				throw new INIKeyNotFoundException();
@@ -57,7 +57,7 @@  discard block
 block discarded – undo
57 57
 	/**
58 58
 	 * @param $key
59 59
 	 */
60
-	public function set($key){
60
+	public function set($key) {
61 61
 		//TODO write this
62 62
 	}
63 63
 }
Please login to merge, or discard this patch.
src/AccessControl/AllAccessListAccessControl.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @param array $keys
19 19
      */
20
-    public function __construct(Array $keys){
20
+    public function __construct(Array $keys) {
21 21
         $this->keys = $keys;
22 22
     }
23 23
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param \LunixREST\Request\Request $request
26 26
      * @return bool true if key is valid
27 27
      */
28
-    public function validateAccess(Request $request){
28
+    public function validateAccess(Request $request) {
29 29
         return $this->validateKey($request->getApiKey());
30 30
     }
31 31
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param $apiKey
34 34
      * @return bool true if key is in the array passed to this object in it's construction
35 35
      */
36
-    public function validateKey($apiKey){
36
+    public function validateKey($apiKey) {
37 37
         return in_array($apiKey, $this->keys);
38 38
     }
39 39
 }
Please login to merge, or discard this patch.
Braces   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -17,7 +17,7 @@  discard block
 block discarded – undo
17 17
     /**
18 18
      * @param array $keys
19 19
      */
20
-    public function __construct(Array $keys){
20
+    public function __construct(Array $keys) {
21 21
         $this->keys = $keys;
22 22
     }
23 23
 
@@ -25,7 +25,7 @@  discard block
 block discarded – undo
25 25
      * @param \LunixREST\Request\Request $request
26 26
      * @return bool true if key is valid
27 27
      */
28
-    public function validateAccess(Request $request){
28
+    public function validateAccess(Request $request) {
29 29
         return $this->validateKey($request->getApiKey());
30 30
     }
31 31
 
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
      * @param $apiKey
34 34
      * @return bool true if key is in the array passed to this object in it's construction
35 35
      */
36
-    public function validateKey($apiKey){
36
+    public function validateKey($apiKey) {
37 37
         return in_array($apiKey, $this->keys);
38 38
     }
39 39
 }
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.