Fix formatting

This commit is contained in:
Timothy Warren 2023-05-18 16:27:31 -04:00
parent e6d71d3cce
commit dbc4c3105a
5 changed files with 8 additions and 7 deletions

View File

@ -36,7 +36,7 @@ final class AnimeTransformer extends AbstractTransformer
$characters = [];
$links = [];
$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);
sort($genres);

View File

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

View File

@ -40,8 +40,8 @@ final class UserTransformer extends AbstractTransformer
return User::from([
'about' => $base['about'] ?? '',
'avatar' => $base['avatarImage']['original']['url'] ?? null,
'birthday' => $base['birthday'] !== null ? Kitsu::formatDate($base['birthday']) . ' (' . Kitsu::friendlyTime(Kitsu::getDateDiff($base['birthday']), 'year') . ')' : null,
'avatar' => $base['avatarImage']['original']['url'] ?? 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)',
'gender' => $base['gender'],
'favorites' => $this->organizeFavorites($favorites),
@ -50,7 +50,7 @@ final class UserTransformer extends AbstractTransformer
'slug' => $base['slug'],
'stats' => $this->organizeStats($stats),
'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;
$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.");
return;
}

View File

@ -142,7 +142,7 @@ final class Kitsu
$now = new DateTimeImmutable();
$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;
$days = $interval->d * self::SECONDS_IN_MINUTE * self::MINUTES_IN_DAY;