Skip to content

Commit

Permalink
Add better not found player response
Browse files Browse the repository at this point in the history
  • Loading branch information
pgrimaud committed Dec 31, 2023
1 parent 451fce0 commit 52961ff
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ If you need help, [create an issue](https://github.com/pgrimaud/lametric-fortnit

# More info

Based on [Fortnite Tracker](https://fortnitetracker.com)
Based on [fortniteapi.io](https://fortniteapi.io)
14 changes: 7 additions & 7 deletions src/Fortnite/Api.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,6 @@

class Api
{
const PLATFORMS = [
'PC' => 'pc',
'Xbox1' => 'xbl',
'PS4' => 'psn',
];

const MODS = [
'solo',
'duo',
Expand Down Expand Up @@ -72,7 +66,13 @@ public function fetchData(): array
throw new InternalErrorException('Internal error');
}

$playerId = $data["account_id"];
if (!isset($data['account_id'])) {
throw new MissingParameterException(
sprintf('Player %s not found', $this->validator->getParameters()['player'])
);
} else {
$playerId = $data['account_id'];
}

try {
$endpoint = 'https://fortniteapi.io/v1/stats?account=' . $playerId;
Expand Down

0 comments on commit 52961ff

Please sign in to comment.