@@ -20,7 +20,7 @@ |
||
20 | 20 | */ |
21 | 21 | public function register() |
22 | 22 | { |
23 | - $this->getContainer()->singleton('Monolog\Logger', function () { |
|
23 | + $this->getContainer()->singleton('Monolog\Logger', function() { |
|
24 | 24 | $log = new Logger('app'); |
25 | 25 | $log->pushHandler( |
26 | 26 | new StreamHandler(__DIR__ . '/../../logs/app.log', Logger::DEBUG) |
@@ -19,7 +19,7 @@ |
||
19 | 19 | */ |
20 | 20 | public function register() |
21 | 21 | { |
22 | - $this->getContainer()->add('Ramsey\Uuid\Uuid', function () { |
|
22 | + $this->getContainer()->add('Ramsey\Uuid\Uuid', function() { |
|
23 | 23 | $uuid = Uuid::Uuid4(); |
24 | 24 | return $uuid; |
25 | 25 | }); |
@@ -28,7 +28,7 @@ |
||
28 | 28 | $response->setStatusCode(404)->setContent( |
29 | 29 | $container->get('Twig_Environment')->render('404.html') |
30 | 30 | ); |
31 | -} catch(\Exception $e) { |
|
31 | +} catch (\Exception $e) { |
|
32 | 32 | $response->setStatusCode(500)->setContent( |
33 | 33 | 'An error occured! ' . $e->getMessage() |
34 | 34 | ); |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | * Builds an item response in Fractal then hands off to the responder |
105 | 105 | * |
106 | 106 | * @param array $item The item to transform |
107 | - * @param mixed $callback The Transformer to pass through to Fractal |
|
107 | + * @param \League\Fractal\TransformerAbstract $callback The Transformer to pass through to Fractal |
|
108 | 108 | * @param \Symfony\Component\HttpFoundation\Response The client's response |
109 | 109 | * |
110 | - * @return array The formatted array |
|
110 | + * @return Response The formatted array |
|
111 | 111 | */ |
112 | 112 | protected function respondWithItem($item, $callback, Response $response) |
113 | 113 | { |
@@ -121,10 +121,10 @@ discard block |
||
121 | 121 | * Builds a collection of items from Fractal then hands off to the responder |
122 | 122 | * |
123 | 123 | * @param array $collection The collection to transform |
124 | - * @param mixed $callback The Transformer to pass through to Fractal |
|
124 | + * @param \League\Fractal\TransformerAbstract $callback The Transformer to pass through to Fractal |
|
125 | 125 | * @param \Symfony\Component\HttpFoundation\Response The client's response |
126 | 126 | * |
127 | - * @return array The formatted array |
|
127 | + * @return Response The formatted array |
|
128 | 128 | */ |
129 | 129 | protected function respondWithCollection($collection, $callback, Response $response) |
130 | 130 | { |
@@ -159,7 +159,7 @@ discard block |
||
159 | 159 | * @param string $message Response message to put in the error |
160 | 160 | * @param int $errorCode Error code to set |
161 | 161 | * |
162 | - * @return array |
|
162 | + * @return Response |
|
163 | 163 | */ |
164 | 164 | protected function respondWithError(Response $response, $message, $errorCode) |
165 | 165 | { |
@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | * @param \Symfony\Component\HttpFoundation\Response $response |
187 | 187 | * @param string $message |
188 | 188 | * |
189 | - * @return void |
|
189 | + * @return Response |
|
190 | 190 | */ |
191 | 191 | public function errorEmpty(Response $response, $message = 'No data / Empty') |
192 | 192 | { |
@@ -200,7 +200,7 @@ discard block |
||
200 | 200 | * @param \Symfony\Component\HttpFoundation\Response $response |
201 | 201 | * @param string $message |
202 | 202 | * |
203 | - * @return void |
|
203 | + * @return Response |
|
204 | 204 | */ |
205 | 205 | public function errorForbidden(Response $response, $message = 'Forbidden') |
206 | 206 | { |
@@ -214,7 +214,7 @@ discard block |
||
214 | 214 | * @param \Symfony\Component\HttpFoundation\Response $response |
215 | 215 | * @param string $message |
216 | 216 | * |
217 | - * @return void |
|
217 | + * @return Response |
|
218 | 218 | */ |
219 | 219 | public function errorInternalError(Response $response, $message = 'Internal Error') |
220 | 220 | { |
@@ -228,7 +228,7 @@ discard block |
||
228 | 228 | * @param \Symfony\Component\HttpFoundation\Response $response |
229 | 229 | * @param string $message |
230 | 230 | * |
231 | - * @return void |
|
231 | + * @return Response |
|
232 | 232 | */ |
233 | 233 | public function errorNotFound(Response $response, $message = 'Resource Not Found') |
234 | 234 | { |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | * @param \Symfony\Component\HttpFoundation\Response $response |
243 | 243 | * @param string $message |
244 | 244 | * |
245 | - * @return void |
|
245 | + * @return Response |
|
246 | 246 | */ |
247 | 247 | public function errorUnauthorized(Response $response, $message = 'Unauthorized') |
248 | 248 | { |
@@ -272,7 +272,7 @@ |
||
272 | 272 | { |
273 | 273 | $queryString = $request->query->get('embed'); |
274 | 274 | |
275 | - if (! empty($queryString)) { |
|
275 | + if (!empty($queryString)) { |
|
276 | 276 | $this->fractal->parseIncludes($request->query->get('embed')); |
277 | 277 | } |
278 | 278 | } |
@@ -26,11 +26,11 @@ |
||
26 | 26 | * |
27 | 27 | * @see AbstractEndpointController::respondWithItem |
28 | 28 | * |
29 | - * @param Symfony\Component\HttpFoundation\Request $request |
|
30 | - * @param Symfony\Component\HttpFoundation\Response $response |
|
29 | + * @param Request $request |
|
30 | + * @param Response $response |
|
31 | 31 | * @param array |
32 | 32 | * |
33 | - * @return array |
|
33 | + * @return Response|null |
|
34 | 34 | */ |
35 | 35 | public function getSingle(Request $request, Response $response, array $args) |
36 | 36 | { |
@@ -57,6 +57,9 @@ discard block |
||
57 | 57 | return $query; |
58 | 58 | } |
59 | 59 | |
60 | + /** |
|
61 | + * @param AbstractQuery $query |
|
62 | + */ |
|
60 | 63 | public function fireStatementAndReturn($query, $single = false) |
61 | 64 | { |
62 | 65 | $pdo = $this->getDatabaseDriver(); |
@@ -104,6 +107,9 @@ discard block |
||
104 | 107 | return $this->fireStatementAndReturn($query); |
105 | 108 | } |
106 | 109 | |
110 | + /** |
|
111 | + * @param string $key |
|
112 | + */ |
|
107 | 113 | public function returnKeyType($key) |
108 | 114 | { |
109 | 115 | switch ($key) { |
@@ -81,7 +81,7 @@ discard block |
||
81 | 81 | $key = $this->returnKeyType($keyType); |
82 | 82 | |
83 | 83 | $query->cols(['*']) |
84 | - ->where("{$key} = {$id}"); |
|
84 | + ->where("{$key} = {$id}"); |
|
85 | 85 | |
86 | 86 | return $this->fireStatementAndReturn($query, true); |
87 | 87 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $key = $this->returnKeyType($keyType); |
100 | 100 | |
101 | 101 | $query->cols(['*']) |
102 | - ->where("{$key} = {$id}"); |
|
102 | + ->where("{$key} = {$id}"); |
|
103 | 103 | |
104 | 104 | return $this->fireStatementAndReturn($query); |
105 | 105 | } |
@@ -132,7 +132,7 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @param array $data |
134 | 134 | * |
135 | - * @return League\Fractal\Resource\Collection |
|
135 | + * @return \League\Fractal\Resource\Collection |
|
136 | 136 | */ |
137 | 137 | public function includeClasses($data) |
138 | 138 | { |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * |
146 | 146 | * @param array $data |
147 | 147 | * |
148 | - * @return League\Fractal\Resource\Collection |
|
148 | + * @return \League\Fractal\Resource\Collection |
|
149 | 149 | */ |
150 | 150 | public function includeCombatHistorys($data) |
151 | 151 | { |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @param array $data |
160 | 160 | * |
161 | - * @return League\Fractal\Resource\Collection |
|
161 | + * @return \League\Fractal\Resource\Item |
|
162 | 162 | */ |
163 | 163 | public function includeFactions($data) |
164 | 164 | { |
@@ -171,7 +171,7 @@ discard block |
||
171 | 171 | * |
172 | 172 | * @param array $data |
173 | 173 | * |
174 | - * @return League\Fractal\Resource\Collection |
|
174 | + * @return \League\Fractal\Resource\Collection |
|
175 | 175 | */ |
176 | 176 | public function includeMapInitials($data) |
177 | 177 | { |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | * |
185 | 185 | * @param array $data |
186 | 186 | * |
187 | - * @return League\Fractal\Resource\Collection |
|
187 | + * @return \League\Fractal\Resource\Collection |
|
188 | 188 | */ |
189 | 189 | public function includeMaps($data) |
190 | 190 | { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * |
198 | 198 | * @param array $data |
199 | 199 | * |
200 | - * @return League\Fractal\Resource\Collection |
|
200 | + * @return \League\Fractal\Resource\Collection |
|
201 | 201 | */ |
202 | 202 | public function includeOutfits($data) |
203 | 203 | { |
@@ -210,7 +210,7 @@ discard block |
||
210 | 210 | * |
211 | 211 | * @param array $data |
212 | 212 | * |
213 | - * @return League\Fractal\Resource\Collection |
|
213 | + * @return \League\Fractal\Resource\Collection |
|
214 | 214 | */ |
215 | 215 | public function includePopulations($data) |
216 | 216 | { |
@@ -223,7 +223,7 @@ discard block |
||
223 | 223 | * |
224 | 224 | * @param array $data |
225 | 225 | * |
226 | - * @return League\Fractal\Resource\Collection |
|
226 | + * @return \League\Fractal\Resource\Collection |
|
227 | 227 | */ |
228 | 228 | public function includePlayers($data) |
229 | 229 | { |
@@ -236,7 +236,7 @@ discard block |
||
236 | 236 | * |
237 | 237 | * @param array $data |
238 | 238 | * |
239 | - * @return League\Fractal\Resource\Collection |
|
239 | + * @return \League\Fractal\Resource\Collection |
|
240 | 240 | */ |
241 | 241 | public function includeVehicles($data) |
242 | 242 | { |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * |
250 | 250 | * @param array $data |
251 | 251 | * |
252 | - * @return League\Fractal\Resource\Collection |
|
252 | + * @return \League\Fractal\Resource\Collection |
|
253 | 253 | */ |
254 | 254 | public function includeWeapons($data) |
255 | 255 | { |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @param array $data |
264 | 264 | * |
265 | - * @return League\Fractal\Resource\Collection |
|
265 | + * @return \League\Fractal\Resource\Collection |
|
266 | 266 | */ |
267 | 267 | public function includeXps($data) |
268 | 268 | { |
@@ -1,8 +1,6 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | 3 | use GuzzleHttp\Client; |
4 | -use GuzzleHttp\Psr7\Request; |
|
5 | -use GuzzleHttp\Psr7\Response; |
|
6 | 4 | |
7 | 5 | class AlertControllerTest extends \PHPUnit_Framework_TestCase |
8 | 6 | { |
@@ -17,21 +17,21 @@ |
||
17 | 17 | |
18 | 18 | // Inflectors |
19 | 19 | $container->inflector('Ps2alerts\Api\Contract\ConfigAwareInterface') |
20 | - ->invokeMethod('setConfig', ['config']); |
|
20 | + ->invokeMethod('setConfig', ['config']); |
|
21 | 21 | $container->inflector('Ps2alerts\Api\Contract\DatabaseAwareInterface') |
22 | - ->invokeMethod('setDatabaseDriver', ['Aura\Sql']); |
|
22 | + ->invokeMethod('setDatabaseDriver', ['Aura\Sql']); |
|
23 | 23 | $container->inflector('Ps2alerts\Api\Contract\LogAwareInterface') |
24 | - ->invokeMethod('setLogDriver', ['Monolog\Logger']); |
|
24 | + ->invokeMethod('setLogDriver', ['Monolog\Logger']); |
|
25 | 25 | $container->inflector('Ps2alerts\Api\Contract\TemplateAwareInterface') |
26 | - ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
26 | + ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
27 | 27 | $container->inflector('Ps2alerts\Api\Contract\RedisAwareInterface') |
28 | - ->invokeMethod('setRedisDriver', ['redis']); |
|
28 | + ->invokeMethod('setRedisDriver', ['redis']); |
|
29 | 29 | $container->inflector('Ps2alerts\Api\Contract\UuidAwareInterface') |
30 | - ->invokeMethod('setUuidDriver', ['Ramsey\Uuid\Uuid']); |
|
30 | + ->invokeMethod('setUuidDriver', ['Ramsey\Uuid\Uuid']); |
|
31 | 31 | |
32 | 32 | |
33 | 33 | // Container Inflector |
34 | 34 | $container->inflector('League\Container\ContainerAwareInterface') |
35 | - ->invokeMethod('setContainer', [$container]); |
|
35 | + ->invokeMethod('setContainer', [$container]); |
|
36 | 36 | |
37 | 37 | return $container; |