Completed
Push — master ( 171cf6...796c00 )
by John
02:14
created
Configuration/Configuration.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 block discarded – undo
2 2
 namespace LunixREST\Configuration;
3 3
 
4 4
 interface Configuration {
5
-	public function get($key);
6
-	public function set($key);
5
+    public function get($key);
6
+    public function set($key);
7 7
 }
Please login to merge, or discard this patch.
Configuration/INIConfiguration.php 1 patch
Indentation   +48 added lines, -48 removed lines patch added patch discarded remove patch
@@ -9,52 +9,52 @@
 block discarded – undo
9 9
  * @package LunixREST\Configuration
10 10
  */
11 11
 class INIConfiguration implements Configuration {
12
-	/**
13
-	 * @var null
14
-	 */
15
-	protected $nameSpace;
16
-	/**
17
-	 * @var
18
-	 */
19
-	protected $filename;
20
-
21
-	/**
22
-	 * @param string $filename
23
-	 * @param string $nameSpace
24
-	 */
25
-	public function __construct($filename, $nameSpace = null){
26
-		$this->filename = $filename;
27
-		$this->nameSpace = $nameSpace;
28
-	}
29
-
30
-	/**
31
-	 * @param $key
32
-	 * @return mixed
33
-	 * @throws INIKeyNotFoundException
34
-	 * @throws INIParseException
35
-	 */
36
-	public function get($key){
37
-		$config = parse_ini_file($this->filename, (bool)$this->nameSpace);
38
-
39
-		if($config === false){
40
-			throw new INIParseException('Could not parse: ' . $this->filename, true);
41
-		}
42
-
43
-		if($this->nameSpace) {
44
-			if(isset($config[$this->nameSpace])) {
45
-				$config = $config[$this->nameSpace];
46
-			} else {
47
-				throw new INIKeyNotFoundException();
48
-			}
49
-		}
50
-
51
-		return isset($config[$key]) ? $config[$key] : null;
52
-	}
53
-
54
-	/**
55
-	 * @param $key
56
-	 */
57
-	public function set($key){
58
-		//TODO write this
59
-	}
12
+    /**
13
+     * @var null
14
+     */
15
+    protected $nameSpace;
16
+    /**
17
+     * @var
18
+     */
19
+    protected $filename;
20
+
21
+    /**
22
+     * @param string $filename
23
+     * @param string $nameSpace
24
+     */
25
+    public function __construct($filename, $nameSpace = null){
26
+        $this->filename = $filename;
27
+        $this->nameSpace = $nameSpace;
28
+    }
29
+
30
+    /**
31
+     * @param $key
32
+     * @return mixed
33
+     * @throws INIKeyNotFoundException
34
+     * @throws INIParseException
35
+     */
36
+    public function get($key){
37
+        $config = parse_ini_file($this->filename, (bool)$this->nameSpace);
38
+
39
+        if($config === false){
40
+            throw new INIParseException('Could not parse: ' . $this->filename, true);
41
+        }
42
+
43
+        if($this->nameSpace) {
44
+            if(isset($config[$this->nameSpace])) {
45
+                $config = $config[$this->nameSpace];
46
+            } else {
47
+                throw new INIKeyNotFoundException();
48
+            }
49
+        }
50
+
51
+        return isset($config[$key]) ? $config[$key] : null;
52
+    }
53
+
54
+    /**
55
+     * @param $key
56
+     */
57
+    public function set($key){
58
+        //TODO write this
59
+    }
60 60
 }
Please login to merge, or discard this patch.
examples/geophone/Endpoints/v1/phonenumbers.php 1 patch
Indentation   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -7,7 +7,7 @@
 block discarded – undo
7 7
 class phonenumbers extends Endpoint {
8 8
 
9 9
     public function get(){
10
-		$geoPhone = new GeoPhone('data.csv');
11
-		return $geoPhone->lookupNumber($this->request->getInstance());
12
-	}
10
+        $geoPhone = new GeoPhone('data.csv');
11
+        return $geoPhone->lookupNumber($this->request->getInstance());
12
+    }
13 13
 }
14 14
\ No newline at end of file
Please login to merge, or discard this patch.
examples/helloworld/Endpoints/v1_0/helloworld.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -5,6 +5,6 @@
 block discarded – undo
5 5
 
6 6
 class helloworld extends Endpoint {
7 7
     public function getAll(){
8
-		return ["helloworld" => "hello world"];
9
-	}
8
+        return ["helloworld" => "hello world"];
9
+    }
10 10
 }
11 11
\ No newline at end of file
Please login to merge, or discard this patch.
examples/helloworld/index.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -9,27 +9,27 @@
 block discarded – undo
9 9
 $router = new \LunixREST\Router\Router($accessControl, $throttle, $formatsConfig, "HelloWorld");
10 10
 
11 11
 try {
12
-	$request =  \LunixREST\Request\Request::createFromURL("GET", [], [], '127.0.0.1', "/1.0/public/helloworld.json");// \LunixREST\Request\Request::createFromURL($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']);
12
+    $request =  \LunixREST\Request\Request::createFromURL("GET", [], [], '127.0.0.1', "/1.0/public/helloworld.json");// \LunixREST\Request\Request::createFromURL($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']);
13 13
 
14
-	try {
15
-		echo $router->handle($request);
16
-	} catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){
17
-		header('400 Bad Request', true, 400);
18
-	} catch(\LunixREST\Exceptions\UnknownEndpointException $e){
19
-		header('404 Not Found', true, 404);
20
-	} catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){
21
-		header('404 Not Found', true, 404);
22
-	} catch(\LunixREST\Exceptions\AccessDeniedException $e){
23
-		header('403 Access Denied', true, 403);
24
-	}  catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){
25
-		header('429 Too Many Requests', true, 429);
26
-	} catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){
27
-		header('500 Internal Server Error', true, 500);
28
-	} catch(Exception $e){
29
-		header('500 Internal Server Error', true, 500);
30
-	}
14
+    try {
15
+        echo $router->handle($request);
16
+    } catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){
17
+        header('400 Bad Request', true, 400);
18
+    } catch(\LunixREST\Exceptions\UnknownEndpointException $e){
19
+        header('404 Not Found', true, 404);
20
+    } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){
21
+        header('404 Not Found', true, 404);
22
+    } catch(\LunixREST\Exceptions\AccessDeniedException $e){
23
+        header('403 Access Denied', true, 403);
24
+    }  catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){
25
+        header('429 Too Many Requests', true, 429);
26
+    } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){
27
+        header('500 Internal Server Error', true, 500);
28
+    } catch(Exception $e){
29
+        header('500 Internal Server Error', true, 500);
30
+    }
31 31
 } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){
32
-	header('400 Bad Request', true, 400);
32
+    header('400 Bad Request', true, 400);
33 33
 } catch(Exception $e){
34
-	header('500 Internal Server Error', true, 500);
34
+    header('500 Internal Server Error', true, 500);
35 35
 }
Please login to merge, or discard this patch.
examples/geophone/index.php 1 patch
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -10,29 +10,29 @@
 block discarded – undo
10 10
 $router = new \LunixREST\Router\Router($accessControl, $throttle, $formatsConfig, "GeoPhone");
11 11
 
12 12
 try {
13
-	$request = \LunixREST\Request\Request::createFromURL("GET", [], [], '127.0.0.1',  "/1/123456/phonenumbers/6517855237.json");// \LunixREST\Request\Request::createFromURL($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']);
13
+    $request = \LunixREST\Request\Request::createFromURL("GET", [], [], '127.0.0.1',  "/1/123456/phonenumbers/6517855237.json");// \LunixREST\Request\Request::createFromURL($_SERVER['REQUEST_METHOD'], getallheaders(), $_REQUEST, $_SERVER['REMOTE_ADDR'], $_SERVER['REQUEST_URI']);
14 14
 
15
-	try {
16
-		echo $router->handle($request);
17
-	} catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){
18
-		header('400 Bad Request', true, 400);
19
-	} catch(\LunixREST\Exceptions\UnknownEndpointException $e){
20
-		header('404 Not Found', true, 404);
21
-	} catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){
22
-		header('404 Not Found', true, 404);
23
-	} catch(\LunixREST\Exceptions\InstanceNotFoundException $e){
24
-		header('404 Not Found', true, 404);
25
-	} catch(\LunixREST\Exceptions\AccessDeniedException $e){
26
-		header('403 Access Denied', true, 403);
27
-	} catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){
28
-		header('429 Too Many Requests', true, 429);
29
-	} catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){
30
-		header('500 Internal Server Error', true, 500);
31
-	} catch(Exception $e){
32
-		header('500 Internal Server Error', true, 500);
33
-	}
15
+    try {
16
+        echo $router->handle($request);
17
+    } catch(\LunixREST\Exceptions\InvalidAPIKeyException $e){
18
+        header('400 Bad Request', true, 400);
19
+    } catch(\LunixREST\Exceptions\UnknownEndpointException $e){
20
+        header('404 Not Found', true, 404);
21
+    } catch(\LunixREST\Exceptions\UnknownResponseFormatException $e){
22
+        header('404 Not Found', true, 404);
23
+    } catch(\LunixREST\Exceptions\InstanceNotFoundException $e){
24
+        header('404 Not Found', true, 404);
25
+    } catch(\LunixREST\Exceptions\AccessDeniedException $e){
26
+        header('403 Access Denied', true, 403);
27
+    } catch(\LunixREST\Exceptions\ThrottleLimitExceededException $e){
28
+        header('429 Too Many Requests', true, 429);
29
+    } catch(\LunixREST\Exceptions\InvalidResponseFormatException $e){
30
+        header('500 Internal Server Error', true, 500);
31
+    } catch(Exception $e){
32
+        header('500 Internal Server Error', true, 500);
33
+    }
34 34
 } catch(\LunixREST\Exceptions\InvalidRequestFormatException $e){
35
-	header('400 Bad Request', 400);
35
+    header('400 Bad Request', 400);
36 36
 } catch(Exception $e){
37
-	header('500 Internal Server Error', true, 500);
37
+    header('500 Internal Server Error', true, 500);
38 38
 }
Please login to merge, or discard this patch.