@@ -17,11 +17,11 @@ discard block |
||
| 17 | 17 | /** |
| 18 | 18 | * Construct |
| 19 | 19 | * |
| 20 | - * @param League\Fractal\Manager $fractal |
|
| 21 | - * @param Ps2alerts\Api\Transformer\Search\OutfitSearchTransformer $outfitSearchTransformer |
|
| 22 | - * @param Ps2alerts\Api\Repository\Metrics\OutfitTotalRepository $outfitTotalRepo |
|
| 23 | - * @param Ps2alerts\Api\Transformer\Search\PlayerSearchTransformer $playerSearchTransformer |
|
| 24 | - * @param Ps2alerts\Api\Repository\Metrics\PlayerTotalRepository $playerTotalRepo |
|
| 20 | + * @param Manager $fractal |
|
| 21 | + * @param OutfitSearchTransformer $outfitSearchTransformer |
|
| 22 | + * @param OutfitTotalRepository $outfitTotalRepo |
|
| 23 | + * @param PlayerSearchTransformer $playerSearchTransformer |
|
| 24 | + * @param PlayerTotalRepository $playerTotalRepo |
|
| 25 | 25 | */ |
| 26 | 26 | public function __construct( |
| 27 | 27 | Manager $fractal, |
@@ -40,11 +40,11 @@ discard block |
||
| 40 | 40 | /** |
| 41 | 41 | * Endpoint to return potential players based on search term |
| 42 | 42 | * |
| 43 | - * @param Psr\Http\Message\ServerRequestInterface $request |
|
| 44 | - * @param Psr\Http\Message\ResponseInterface $response |
|
| 43 | + * @param ServerRequestInterface $request |
|
| 44 | + * @param ResponseInterface $response |
|
| 45 | 45 | * @param array $args |
| 46 | 46 | * |
| 47 | - * @return \League\Fractal\TransformerAbstract |
|
| 47 | + * @return ResponseInterface|null |
|
| 48 | 48 | */ |
| 49 | 49 | public function getPlayersByTerm(ServerRequestInterface $request, ResponseInterface $response, array $args) |
| 50 | 50 | { |
@@ -67,11 +67,11 @@ discard block |
||
| 67 | 67 | /** |
| 68 | 68 | * Endpoint to return potential players based on search term |
| 69 | 69 | * |
| 70 | - * @param Psr\Http\Message\ServerRequestInterface $request |
|
| 71 | - * @param Psr\Http\Message\ResponseInterface $response |
|
| 70 | + * @param ServerRequestInterface $request |
|
| 71 | + * @param ResponseInterface $response |
|
| 72 | 72 | * @param array $args |
| 73 | 73 | * |
| 74 | - * @return \League\Fractal\TransformerAbstract |
|
| 74 | + * @return ResponseInterface|null |
|
| 75 | 75 | */ |
| 76 | 76 | public function getOutfitsByTerm(ServerRequestInterface $request, ResponseInterface $response, array $args) |
| 77 | 77 | { |
@@ -4,7 +4,6 @@ |
||
| 4 | 4 | |
| 5 | 5 | use League\Fractal\Manager; |
| 6 | 6 | use Ps2alerts\Api\Controller\Endpoint\AbstractEndpointController; |
| 7 | -use Ps2alerts\Api\Exception\InvalidArgumentException; |
|
| 8 | 7 | use Ps2alerts\Api\Repository\Metrics\OutfitTotalRepository; |
| 9 | 8 | use Ps2alerts\Api\Repository\Metrics\PlayerTotalRepository; |
| 10 | 9 | use Ps2alerts\Api\Transformer\Search\OutfitSearchTransformer; |
@@ -52,7 +52,7 @@ discard block |
||
| 52 | 52 | if ($this->parsePlayerName($args['term'], $response)) { |
| 53 | 53 | $players = $this->searchForPlayer($args['term']); |
| 54 | 54 | |
| 55 | - if (! empty($players)) { |
|
| 55 | + if (!empty($players)) { |
|
| 56 | 56 | return $this->respond( |
| 57 | 57 | 'collection', |
| 58 | 58 | $players, |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | if ($this->parseOutfitName($name, $response)) { |
| 82 | 82 | $outfits = $this->searchForOutfit($name); |
| 83 | 83 | |
| 84 | - if (! empty($outfits)) { |
|
| 84 | + if (!empty($outfits)) { |
|
| 85 | 85 | return $this->respond( |
| 86 | 86 | 'collection', |
| 87 | 87 | $outfits, |
@@ -199,7 +199,7 @@ discard block |
||
| 199 | 199 | return $this->errorWrongArgs('Player ID cannot be longer than 19 characters.'); |
| 200 | 200 | } |
| 201 | 201 | |
| 202 | - if (! is_numeric($id)) { |
|
| 202 | + if (!is_numeric($id)) { |
|
| 203 | 203 | return $this->errorWrongArgs('Player ID must be numeric.'); |
| 204 | 204 | } |
| 205 | 205 | |
@@ -14,7 +14,6 @@ |
||
| 14 | 14 | use Ps2alerts\Api\Repository\Metrics\VehicleTotalRepository; |
| 15 | 15 | use Ps2alerts\Api\Repository\Metrics\WeaponTotalRepository; |
| 16 | 16 | use Ps2alerts\Api\Repository\Metrics\XpRepository; |
| 17 | - |
|
| 18 | 17 | use Ps2alerts\Api\Transformer\Metrics\ClassTransformer; |
| 19 | 18 | use Ps2alerts\Api\Transformer\Metrics\CombatHistoryTransformer; |
| 20 | 19 | use Ps2alerts\Api\Transformer\Metrics\CombatTransformer; |
@@ -57,7 +57,6 @@ |
||
| 57 | 57 | /** |
| 58 | 58 | * The tranform method required by Fractal to parse the data and return proper typing and fields. |
| 59 | 59 | * |
| 60 | - * @param array $data Data to transform |
|
| 61 | 60 | * |
| 62 | 61 | * @return array |
| 63 | 62 | */ |
@@ -219,6 +219,9 @@ |
||
| 219 | 219 | return $players; |
| 220 | 220 | } |
| 221 | 221 | |
| 222 | + /** |
|
| 223 | + * @param integer $offset |
|
| 224 | + */ |
|
| 222 | 225 | public function getOutfitMembers($data, $offset) |
| 223 | 226 | { |
| 224 | 227 | $client = $this->getHttpClientDriver(); |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | $key = "ps2alerts:api:profiles:outfit:players:{$data['outfitID']}"; |
| 192 | 192 | |
| 193 | 193 | // If we have this cached already |
| 194 | - if (! empty($redis->exists($key))) { |
|
| 194 | + if (!empty($redis->exists($key))) { |
|
| 195 | 195 | return json_decode($redis->get($key), true); |
| 196 | 196 | } |
| 197 | 197 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $key = "ps2alerts:api:profiles:outfit:census:members:{$data['outfitID']}:{$offset}"; |
| 228 | 228 | |
| 229 | 229 | // If we have this cached already |
| 230 | - if (! empty($redis->exists($key))) { |
|
| 230 | + if (!empty($redis->exists($key))) { |
|
| 231 | 231 | return json_decode($redis->get($key)); |
| 232 | 232 | } |
| 233 | 233 | |
@@ -72,7 +72,7 @@ discard block |
||
| 72 | 72 | * |
| 73 | 73 | * @param array $data |
| 74 | 74 | * |
| 75 | - * @return \League\Fractal\Resource\Collection |
|
| 75 | + * @return \League\Fractal\Resource\Item |
|
| 76 | 76 | */ |
| 77 | 77 | public function includeCensus($data) |
| 78 | 78 | { |
@@ -144,9 +144,8 @@ discard block |
||
| 144 | 144 | /** |
| 145 | 145 | * Gets Metrics for a player |
| 146 | 146 | * |
| 147 | - * @param array $player |
|
| 148 | 147 | * |
| 149 | - * @return array |
|
| 148 | + * @return \League\Fractal\Resource\Item |
|
| 150 | 149 | */ |
| 151 | 150 | public function includeMetrics($data) |
| 152 | 151 | { |
@@ -179,7 +178,7 @@ discard block |
||
| 179 | 178 | * |
| 180 | 179 | * @param array $data |
| 181 | 180 | * |
| 182 | - * @return \League\Fractal\Resource\Collection |
|
| 181 | + * @return \League\Fractal\Resource\Item |
|
| 183 | 182 | */ |
| 184 | 183 | public function includeOutfit($data) |
| 185 | 184 | { |
@@ -184,7 +184,7 @@ discard block |
||
| 184 | 184 | $key = $this->returnKeyType($keyType); |
| 185 | 185 | |
| 186 | 186 | $query->cols(['*']) |
| 187 | - ->where("{$key} = ?", $id); |
|
| 187 | + ->where("{$key} = ?", $id); |
|
| 188 | 188 | |
| 189 | 189 | return $this->fireStatementAndReturn($query, true, $object, $archive); |
| 190 | 190 | } |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $key = $this->returnKeyType($keyType); |
| 222 | 222 | |
| 223 | 223 | $query->cols(['*']) |
| 224 | - ->where("{$key} = ?", $id); |
|
| 224 | + ->where("{$key} = ?", $id); |
|
| 225 | 225 | |
| 226 | 226 | return $this->fireStatementAndReturn($query, false, false, $archive); |
| 227 | 227 | } |
@@ -18,7 +18,7 @@ |
||
| 18 | 18 | $obj = [ |
| 19 | 19 | 'id' => (string) $data->outfit_id, // Bigint |
| 20 | 20 | 'name' => (string) $data->name, |
| 21 | - 'tag' => (! empty($data->alias)) ? (string) $data->alias : null, |
|
| 21 | + 'tag' => (!empty($data->alias)) ? (string) $data->alias : null, |
|
| 22 | 22 | 'faction' => (int) $data->leader->faction_id, |
| 23 | 23 | 'count' => (int) $data->member_count, |
| 24 | 24 | 'leader' => (string) $data->leader_character_id, |
@@ -15,7 +15,7 @@ |
||
| 15 | 15 | */ |
| 16 | 16 | public function transform($data) |
| 17 | 17 | { |
| 18 | - if (! isset($data['playerOutfit'])) { |
|
| 18 | + if (!isset($data['playerOutfit'])) { |
|
| 19 | 19 | $outfit = null; |
| 20 | 20 | } else { |
| 21 | 21 | $outfit = $data['playerOutfit']; |
@@ -19,43 +19,43 @@ |
||
| 19 | 19 | |
| 20 | 20 | // Inflectors |
| 21 | 21 | $container->inflector('Ps2alerts\Api\Contract\ConfigAwareInterface') |
| 22 | - ->invokeMethod('setConfig', ['config']); |
|
| 22 | + ->invokeMethod('setConfig', ['config']); |
|
| 23 | 23 | $container->inflector('Ps2alerts\Api\Contract\DatabaseAwareInterface') |
| 24 | - ->invokeMethod('setDatabaseDriver', ['Database']) |
|
| 25 | - ->invokeMethod('setDatabaseDataDriver', ['Database\Data']) |
|
| 26 | - ->invokeMethod('setDatabaseArchiveDriver', ['Database\Archive']); |
|
| 24 | + ->invokeMethod('setDatabaseDriver', ['Database']) |
|
| 25 | + ->invokeMethod('setDatabaseDataDriver', ['Database\Data']) |
|
| 26 | + ->invokeMethod('setDatabaseArchiveDriver', ['Database\Archive']); |
|
| 27 | 27 | $container->inflector('Ps2alerts\Api\Contract\LogAwareInterface') |
| 28 | - ->invokeMethod('setLogDriver', ['Monolog\Logger']); |
|
| 28 | + ->invokeMethod('setLogDriver', ['Monolog\Logger']); |
|
| 29 | 29 | $container->inflector('Ps2alerts\Api\Contract\HttpClientAwareInterface') |
| 30 | - ->invokeMethod('setHttpClientDriver', ['GuzzleHttp\Client']); |
|
| 30 | + ->invokeMethod('setHttpClientDriver', ['GuzzleHttp\Client']); |
|
| 31 | 31 | $container->inflector('Ps2alerts\Api\Contract\HttpMessageAwareInterface') |
| 32 | - ->invokeMethods([ |
|
| 33 | - 'setResponse' => ['Zend\Diactoros\Response'], |
|
| 34 | - 'setRequest' => ['Zend\Diactoros\ServerRequest'] |
|
| 35 | - ]); |
|
| 32 | + ->invokeMethods([ |
|
| 33 | + 'setResponse' => ['Zend\Diactoros\Response'], |
|
| 34 | + 'setRequest' => ['Zend\Diactoros\ServerRequest'] |
|
| 35 | + ]); |
|
| 36 | 36 | $container->inflector('Ps2alerts\Api\Contract\TemplateAwareInterface') |
| 37 | - ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
| 37 | + ->invokeMethod('setTemplateDriver', ['Twig_Environment']); |
|
| 38 | 38 | $container->inflector('Ps2alerts\Api\Contract\RedisAwareInterface') |
| 39 | - ->invokeMethod('setRedisDriver', ['redis']); |
|
| 39 | + ->invokeMethod('setRedisDriver', ['redis']); |
|
| 40 | 40 | $container->inflector('Ps2alerts\Api\Contract\UuidAwareInterface') |
| 41 | - ->invokeMethod('setUuidDriver', ['Ramsey\Uuid\Uuid']); |
|
| 41 | + ->invokeMethod('setUuidDriver', ['Ramsey\Uuid\Uuid']); |
|
| 42 | 42 | |
| 43 | 43 | // Container Inflector |
| 44 | 44 | $container->inflector('League\Container\ContainerAwareInterface') |
| 45 | - ->invokeMethod('setContainer', [$container]); |
|
| 45 | + ->invokeMethod('setContainer', [$container]); |
|
| 46 | 46 | |
| 47 | 47 | // Processing deps |
| 48 | 48 | $container->add('Ps2alerts\Api\Factory\AuraFactory') |
| 49 | - ->withArgument('Aura\SqlQuery\QueryFactory'); |
|
| 49 | + ->withArgument('Aura\SqlQuery\QueryFactory'); |
|
| 50 | 50 | |
| 51 | 51 | $container->add('Ps2alerts\Api\Transformer\DataTransformer') |
| 52 | - ->withArgument('Ps2alerts\Api\Repository\Data\FacilityDataRepository') |
|
| 53 | - ->withArgument('Ps2alerts\Api\Repository\Data\VehicleDataRepository') |
|
| 54 | - ->withArgument('Ps2alerts\Api\Repository\Data\WeaponDataRepository') |
|
| 55 | - ->withArgument('Ps2alerts\Api\Repository\Data\XpDataRepository'); |
|
| 52 | + ->withArgument('Ps2alerts\Api\Repository\Data\FacilityDataRepository') |
|
| 53 | + ->withArgument('Ps2alerts\Api\Repository\Data\VehicleDataRepository') |
|
| 54 | + ->withArgument('Ps2alerts\Api\Repository\Data\WeaponDataRepository') |
|
| 55 | + ->withArgument('Ps2alerts\Api\Repository\Data\XpDataRepository'); |
|
| 56 | 56 | |
| 57 | 57 | $container->add('Ps2alerts\Api\Controller\Endpoint\Data\DataEndpointController') |
| 58 | - ->withArgument('League\Fractal\Manager') |
|
| 59 | - ->withArgument('Ps2alerts\Api\Transformer\DataTransformer'); |
|
| 58 | + ->withArgument('League\Fractal\Manager') |
|
| 59 | + ->withArgument('Ps2alerts\Api\Transformer\DataTransformer'); |
|
| 60 | 60 | |
| 61 | 61 | return $container; |