Completed
Push — master ( 5ddc50...8d892a )
by John
02:13
created
src/AccessControl/OneKeyAccessControl.php 1 patch
Braces   +4 added lines, -8 removed lines patch added patch discarded remove patch
@@ -8,8 +8,7 @@  discard block
 block discarded – undo
8 8
  * Class OneKeyAccessControl
9 9
  * @package LunixREST\AccessControl
10 10
  */
11
-class OneKeyAccessControl implements AccessControl
12
-{
11
+class OneKeyAccessControl implements AccessControl {
13 12
     /**
14 13
      * @var string
15 14
      */
@@ -18,8 +17,7 @@  discard block
 block discarded – undo
18 17
     /**
19 18
      * @param string $key
20 19
      */
21
-    public function __construct($key)
22
-    {
20
+    public function __construct($key) {
23 21
         $this->key = $key;
24 22
     }
25 23
 
@@ -27,8 +25,7 @@  discard block
 block discarded – undo
27 25
      * @param \LunixREST\APIRequest\APIRequest $request
28 26
      * @return bool true if key is valid
29 27
      */
30
-    public function validateAccess(APIRequest $request)
31
-    {
28
+    public function validateAccess(APIRequest $request) {
32 29
         return $this->validateKey($request->getApiKey());
33 30
     }
34 31
 
@@ -36,8 +33,7 @@  discard block
 block discarded – undo
36 33
      * @param $apiKey
37 34
      * @return bool true if key is the key specified in the constructor
38 35
      */
39
-    public function validateKey($apiKey)
40
-    {
36
+    public function validateKey($apiKey) {
41 37
         return $apiKey === $this->key;
42 38
     }
43 39
 }
Please login to merge, or discard this patch.
src/Throttle/NoThrottle.php 1 patch
Braces   +2 added lines, -4 removed lines patch added patch discarded remove patch
@@ -3,8 +3,7 @@  discard block
 block discarded – undo
3 3
 
4 4
 use LunixREST\APIRequest\APIRequest;
5 5
 
6
-class NoThrottle implements Throttle
7
-{
6
+class NoThrottle implements Throttle {
8 7
     /**
9 8
      * Never throttle
10 9
      * @param \LunixREST\APIRequest\APIRequest $request
@@ -19,8 +18,7 @@  discard block
 block discarded – undo
19 18
      * Log that a request took place
20 19
      * @param \LunixREST\APIRequest\APIRequest $request
21 20
      */
22
-    public function logRequest(APIRequest $request)
23
-    {
21
+    public function logRequest(APIRequest $request) {
24 22
         //Do nothing
25 23
     }
26 24
 }
Please login to merge, or discard this patch.
src/APIRequest/APIRequest.php 1 patch
Braces   +5 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,8 +6,7 @@  discard block
 block discarded – undo
6 6
  * Class APIRequest
7 7
  * @package LunixREST\Request
8 8
  */
9
-class APIRequest
10
-{
9
+class APIRequest {
11 10
     /**
12 11
      * @var string
13 12
      */
@@ -91,8 +90,7 @@  discard block
 block discarded – undo
91 90
     /**
92 91
      * @return null|string
93 92
      */
94
-    public function getElement()
95
-    {
93
+    public function getElement() {
96 94
         return $this->element;
97 95
     }
98 96
 
@@ -107,16 +105,14 @@  discard block
 block discarded – undo
107 105
     /**
108 106
      * @return null|string
109 107
      */
110
-    public function getVersion()
111
-    {
108
+    public function getVersion() {
112 109
         return $this->version;
113 110
     }
114 111
 
115 112
     /**
116 113
      * @return null|string
117 114
      */
118
-    public function getApiKey()
119
-    {
115
+    public function getApiKey() {
120 116
         return $this->apiKey;
121 117
     }
122 118
 
@@ -131,8 +127,7 @@  discard block
 block discarded – undo
131 127
     /**
132 128
      * @return array|null|object
133 129
      */
134
-    public function getData()
135
-    {
130
+    public function getData() {
136 131
         return $this->data;
137 132
     }
138 133
 }
Please login to merge, or discard this patch.
src/APIRequest/URLParser/ParsedURL.php 1 patch
Braces   +6 added lines, -12 removed lines patch added patch discarded remove patch
@@ -1,8 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2 2
 namespace LunixREST\APIRequest\URLParser;
3 3
 
4
-class ParsedURL
5
-{
4
+class ParsedURL {
6 5
     /**
7 6
      * @var string
8 7
      */
@@ -37,8 +36,7 @@  discard block
 block discarded – undo
37 36
      * @param array $acceptableMIMETypes
38 37
      * @param null|string $queryString
39 38
      */
40
-    public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString)
41
-    {
39
+    public function __construct(string $endpoint, ?string $element, ?string $version, ?string $apiKey, array $acceptableMIMETypes, ?string $queryString) {
42 40
         $this->endpoint = $endpoint;
43 41
         $this->element = $element;
44 42
         $this->version = $version;
@@ -58,24 +56,21 @@  discard block
 block discarded – undo
58 56
     /**
59 57
      * @return null|string
60 58
      */
61
-    public function getElement()
62
-    {
59
+    public function getElement() {
63 60
         return $this->element;
64 61
     }
65 62
 
66 63
     /**
67 64
      * @return null|string
68 65
      */
69
-    public function getVersion()
70
-    {
66
+    public function getVersion() {
71 67
         return $this->version;
72 68
     }
73 69
 
74 70
     /**
75 71
      * @return null|string
76 72
      */
77
-    public function getApiKey()
78
-    {
73
+    public function getApiKey() {
79 74
         return $this->apiKey;
80 75
     }
81 76
 
@@ -90,8 +85,7 @@  discard block
 block discarded – undo
90 85
     /**
91 86
      * @return null|string
92 87
      */
93
-    public function getQueryString()
94
-    {
88
+    public function getQueryString() {
95 89
         return $this->queryString;
96 90
     }
97 91
 }
Please login to merge, or discard this patch.
src/Server/GenericServer.php 1 patch
Braces   +3 added lines, -6 removed lines patch added patch discarded remove patch
@@ -14,8 +14,7 @@  discard block
 block discarded – undo
14 14
 use LunixREST\Server\Exceptions\MethodNotFoundException;
15 15
 use LunixREST\Throttle\Throttle;
16 16
 
17
-class GenericServer implements Server
18
-{
17
+class GenericServer implements Server {
19 18
     /**
20 19
      * @var AccessControl
21 20
      */
@@ -86,8 +85,7 @@  discard block
 block discarded – undo
86 85
      * @param APIRequest $request
87 86
      * @throws InvalidAPIKeyException
88 87
      */
89
-    protected function validateKey(APIRequest $request)
90
-    {
88
+    protected function validateKey(APIRequest $request) {
91 89
         if (!$this->accessControl->validateKey($request->getApiKey())) {
92 90
             throw new InvalidAPIKeyException('Invalid API key');
93 91
         }
@@ -98,8 +96,7 @@  discard block
 block discarded – undo
98 96
      * @throws NotAcceptableResponseTypeException
99 97
      */
100 98
     //TODO: Handle wildcards in request MIME types (*/*)
101
-    protected function validateAcceptableMIMETypes(APIRequest $request)
102
-    {
99
+    protected function validateAcceptableMIMETypes(APIRequest $request) {
103 100
         $formats = $this->responseFactory->getSupportedMIMETypes();
104 101
         if (empty($formats) || (
105 102
                 !empty($request->getAcceptableMIMETypes()) && empty(array_intersect($request->getAcceptableMIMETypes(),
Please login to merge, or discard this patch.
src/Server/Router.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -10,8 +10,7 @@
 block discarded – undo
10 10
  * Interface Router
11 11
  * @package LunixREST\Server
12 12
  */
13
-interface Router
14
-{
13
+interface Router {
15 14
     /**
16 15
      * @param APIRequest $request
17 16
      * @return array|null|object
Please login to merge, or discard this patch.
src/Server/Server.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -15,8 +15,7 @@
 block discarded – undo
15 15
  * Interface Server
16 16
  * @package LunixREST\Server
17 17
  */
18
-interface Server
19
-{
18
+interface Server {
20 19
     /**
21 20
      * @param APIRequest $request
22 21
      * @return APIResponse
Please login to merge, or discard this patch.
src/APIResponse/APIResponse.php 1 patch
Braces   +1 added lines, -2 removed lines patch added patch discarded remove patch
@@ -7,8 +7,7 @@
 block discarded – undo
7 7
  * Class APIResponse
8 8
  * @package LunixREST\APIResponse
9 9
  */
10
-interface APIResponse
11
-{
10
+interface APIResponse {
12 11
     /**
13 12
      * @return null|object|array
14 13
      */
Please login to merge, or discard this patch.
src/Endpoint/DefaultEndpoint.php 1 patch
Braces   +11 added lines, -22 removed lines patch added patch discarded remove patch
@@ -9,15 +9,13 @@  discard block
 block discarded – undo
9 9
  * Class Endpoint
10 10
  * @package LunixREST\Endpoints
11 11
  */
12
-class DefaultEndpoint implements Endpoint
13
-{
12
+class DefaultEndpoint implements Endpoint {
14 13
     /**
15 14
      * @param APIRequest $request
16 15
      * @return null|array|object
17 16
      * @throws UnsupportedMethodException
18 17
      */
19
-    public function get(APIRequest $request)
20
-    {
18
+    public function get(APIRequest $request) {
21 19
         throw new UnsupportedMethodException('Method not supported');
22 20
     }
23 21
 
@@ -26,8 +24,7 @@  discard block
 block discarded – undo
26 24
      * @return null|array|object
27 25
      * @throws UnsupportedMethodException
28 26
      */
29
-    public function getAll(APIRequest $request)
30
-    {
27
+    public function getAll(APIRequest $request) {
31 28
         throw new UnsupportedMethodException('Method not supported');
32 29
     }
33 30
 
@@ -36,8 +33,7 @@  discard block
 block discarded – undo
36 33
      * @return null|array|object
37 34
      * @throws UnsupportedMethodException
38 35
      */
39
-    public function post(APIRequest $request)
40
-    {
36
+    public function post(APIRequest $request) {
41 37
         throw new UnsupportedMethodException('Method not supported');
42 38
     }
43 39
 
@@ -46,8 +42,7 @@  discard block
 block discarded – undo
46 42
      * @return null|array|object
47 43
      * @throws UnsupportedMethodException
48 44
      */
49
-    public function postAll(APIRequest $request)
50
-    {
45
+    public function postAll(APIRequest $request) {
51 46
         throw new UnsupportedMethodException('Method not supported');
52 47
     }
53 48
 
@@ -56,8 +51,7 @@  discard block
 block discarded – undo
56 51
      * @return null|array|object
57 52
      * @throws UnsupportedMethodException
58 53
      */
59
-    public function put(APIRequest $request)
60
-    {
54
+    public function put(APIRequest $request) {
61 55
         throw new UnsupportedMethodException('Method not supported');
62 56
     }
63 57
 
@@ -66,8 +60,7 @@  discard block
 block discarded – undo
66 60
      * @return null|array|object
67 61
      * @throws UnsupportedMethodException
68 62
      */
69
-    public function putAll(APIRequest $request)
70
-    {
63
+    public function putAll(APIRequest $request) {
71 64
         throw new UnsupportedMethodException('Method not supported');
72 65
     }
73 66
 
@@ -76,8 +69,7 @@  discard block
 block discarded – undo
76 69
      * @return null|array|object
77 70
      * @throws UnsupportedMethodException
78 71
      */
79
-    public function options(APIRequest $request)
80
-    {
72
+    public function options(APIRequest $request) {
81 73
         throw new UnsupportedMethodException('Method not supported');
82 74
     }
83 75
 
@@ -86,8 +78,7 @@  discard block
 block discarded – undo
86 78
      * @return null|array|object
87 79
      * @throws UnsupportedMethodException
88 80
      */
89
-    public function optionsAll(APIRequest $request)
90
-    {
81
+    public function optionsAll(APIRequest $request) {
91 82
         throw new UnsupportedMethodException('Method not supported');
92 83
     }
93 84
 
@@ -96,8 +87,7 @@  discard block
 block discarded – undo
96 87
      * @return null|array|object
97 88
      * @throws UnsupportedMethodException
98 89
      */
99
-    public function delete(APIRequest $request)
100
-    {
90
+    public function delete(APIRequest $request) {
101 91
         throw new UnsupportedMethodException('Method not supported');
102 92
     }
103 93
 
@@ -106,8 +96,7 @@  discard block
 block discarded – undo
106 96
      * @return null|array|object
107 97
      * @throws UnsupportedMethodException
108 98
      */
109
-    public function deleteAll(APIRequest $request)
110
-    {
99
+    public function deleteAll(APIRequest $request) {
111 100
         throw new UnsupportedMethodException('Method not supported');
112 101
     }
113 102
 }
Please login to merge, or discard this patch.