Version 5.1 - All the GraphQL #32

Closed
timw4mail wants to merge 1160 commits from develop into master
5 changed files with 8 additions and 7 deletions
Showing only changes of commit dbc4c3105a - Show all commits

View File

@ -36,7 +36,7 @@ final class AnimeTransformer extends AbstractTransformer
$characters = []; $characters = [];
$links = []; $links = [];
$staff = []; $staff = [];
$rawGenres = array_filter($base['categories']['nodes'], static fn ($c) => $c !== null); $rawGenres = array_filter($base['categories']['nodes'], static fn ($c) => $c !== NULL);
$genres = array_map(static fn ($genre) => $genre['title']['en'], $rawGenres); $genres = array_map(static fn ($genre) => $genre['title']['en'], $rawGenres);
sort($genres); sort($genres);

View File

@ -98,7 +98,7 @@ final class PersonTransformer extends AbstractTransformer
{ {
foreach ($data['voices']['nodes'] as $voicing) foreach ($data['voices']['nodes'] as $voicing)
{ {
if ($voicing === null) if ($voicing === NULL)
{ {
continue; continue;
} }

View File

@ -40,8 +40,8 @@ final class UserTransformer extends AbstractTransformer
return User::from([ return User::from([
'about' => $base['about'] ?? '', 'about' => $base['about'] ?? '',
'avatar' => $base['avatarImage']['original']['url'] ?? null, 'avatar' => $base['avatarImage']['original']['url'] ?? NULL,
'birthday' => $base['birthday'] !== null ? Kitsu::formatDate($base['birthday']) . ' (' . Kitsu::friendlyTime(Kitsu::getDateDiff($base['birthday']), 'year') . ')' : null, 'birthday' => $base['birthday'] !== NULL ? Kitsu::formatDate($base['birthday']) . ' (' . Kitsu::friendlyTime(Kitsu::getDateDiff($base['birthday']), 'year') . ')' : NULL,
'joinDate' => Kitsu::formatDate($base['createdAt']) . ' (' . Kitsu::friendlyTime(Kitsu::getDateDiff($base['createdAt']), 'day') . ' ago)', 'joinDate' => Kitsu::formatDate($base['createdAt']) . ' (' . Kitsu::friendlyTime(Kitsu::getDateDiff($base['createdAt']), 'day') . ' ago)',
'gender' => $base['gender'], 'gender' => $base['gender'],
'favorites' => $this->organizeFavorites($favorites), 'favorites' => $this->organizeFavorites($favorites),
@ -50,7 +50,7 @@ final class UserTransformer extends AbstractTransformer
'slug' => $base['slug'], 'slug' => $base['slug'],
'stats' => $this->organizeStats($stats), 'stats' => $this->organizeStats($stats),
'waifu' => $waifu, 'waifu' => $waifu,
'website' => $base['siteLinks']['nodes'][0]['url'] ?? null, 'website' => $base['siteLinks']['nodes'][0]['url'] ?? NULL,
]); ]);
} }

View File

@ -69,9 +69,10 @@ final class User extends BaseController
: $username; : $username;
$rawData = $this->kitsuModel->getUserData($username); $rawData = $this->kitsuModel->getUserData($username);
if ($rawData['data']['findProfileBySlug'] === null) if ($rawData['data']['findProfileBySlug'] === NULL)
{ {
$this->notFound('Sorry, user not found', "The user '$username' does not seem to exist."); $this->notFound('Sorry, user not found', "The user '$username' does not seem to exist.");
return; return;
} }

View File

@ -142,7 +142,7 @@ final class Kitsu
$now = new DateTimeImmutable(); $now = new DateTimeImmutable();
$then = new DateTimeImmutable($date); $then = new DateTimeImmutable($date);
$interval = $now->diff($then, true); $interval = $now->diff($then, TRUE);
$years = $interval->y * self::SECONDS_IN_MINUTE * self::MINUTES_IN_YEAR; $years = $interval->y * self::SECONDS_IN_MINUTE * self::MINUTES_IN_YEAR;
$days = $interval->d * self::SECONDS_IN_MINUTE * self::MINUTES_IN_DAY; $days = $interval->d * self::SECONDS_IN_MINUTE * self::MINUTES_IN_DAY;