@@ -7,8 +7,7 @@ |
||
7 | 7 | * Interface Throttle |
8 | 8 | * @package LunixREST\Throttle |
9 | 9 | */ |
10 | -interface Throttle |
|
11 | -{ |
|
10 | +interface Throttle { |
|
12 | 11 | /** |
13 | 12 | * Returns true if the given request should be throttled in our implementation |
14 | 13 | * @param \LunixREST\Request\Request $request |
@@ -7,8 +7,7 @@ |
||
7 | 7 | * Interface AccessControl |
8 | 8 | * @package LunixREST\AccessControl |
9 | 9 | */ |
10 | -interface AccessControl |
|
11 | -{ |
|
10 | +interface AccessControl { |
|
12 | 11 | /** |
13 | 12 | * Validates if a given request should be able to access what it's trying to |
14 | 13 | * @param $request |
@@ -8,14 +8,12 @@ discard block |
||
8 | 8 | * Class PublicAccessControl |
9 | 9 | * @package LunixREST\AccessControl |
10 | 10 | */ |
11 | -class PublicAccessControl implements AccessControl |
|
12 | -{ |
|
11 | +class PublicAccessControl implements AccessControl { |
|
13 | 12 | /** |
14 | 13 | * @param \LunixREST\APIRequest\APIRequest $request |
15 | 14 | * @return bool |
16 | 15 | */ |
17 | - public function validateAccess(APIRequest $request) |
|
18 | - { |
|
16 | + public function validateAccess(APIRequest $request) { |
|
19 | 17 | return true; |
20 | 18 | } |
21 | 19 | |
@@ -23,8 +21,7 @@ discard block |
||
23 | 21 | * @param $apiKey |
24 | 22 | * @return bool |
25 | 23 | */ |
26 | - public function validateKey($apiKey) |
|
27 | - { |
|
24 | + public function validateKey($apiKey) { |
|
28 | 25 | return true; |
29 | 26 | } |
30 | 27 | } |
@@ -8,8 +8,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -3,8 +3,7 @@ discard block |
||
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 |
||
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 | } |
@@ -55,10 +55,10 @@ |
||
55 | 55 | public function __construct( |
56 | 56 | string $method, |
57 | 57 | string $endpoint, |
58 | - ?string $element, |
|
58 | + ? string $element, |
|
59 | 59 | array $acceptableMIMETypes, |
60 | - ?string $version, |
|
61 | - ?string $apiKey, |
|
60 | + ? string $version, |
|
61 | + ? string $apiKey, |
|
62 | 62 | array $queryData, |
63 | 63 | $data |
64 | 64 | ) { |
@@ -6,8 +6,7 @@ discard block |
||
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 |
||
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 |
||
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 |
||
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 | } |
@@ -10,10 +10,8 @@ |
||
10 | 10 | * Class BasicRequestFactory |
11 | 11 | * @package LunixREST\Request\RequestFactory |
12 | 12 | */ |
13 | -class DefaultRequestFactory extends GenericRequestFactory |
|
14 | -{ |
|
15 | - public function __construct(URLParser $URLParser) |
|
16 | - { |
|
13 | +class DefaultRequestFactory extends GenericRequestFactory { |
|
14 | + public function __construct(URLParser $URLParser) { |
|
17 | 15 | parent::__construct($URLParser, new DefaultBodyParserFactory(), new DefaultHeaderParser()); |
18 | 16 | } |
19 | 17 | } |
@@ -3,8 +3,7 @@ |
||
3 | 3 | |
4 | 4 | use LunixREST\Request\URLParser\Exceptions\InvalidRequestURLException; |
5 | 5 | |
6 | -interface URLParser |
|
7 | -{ |
|
6 | +interface URLParser { |
|
8 | 7 | /** |
9 | 8 | * Parses API request data out of a url |
10 | 9 | * @param $url |
@@ -1,7 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace LunixREST\Request\URLParser\Exceptions; |
3 | 3 | |
4 | -class InvalidRequestURLException extends \Exception |
|
5 | -{ |
|
4 | +class InvalidRequestURLException extends \Exception { |
|
6 | 5 | |
7 | 6 | } |