the browser-facing portion of osu!
at master 29 lines 1.1 kB view raw
1<?php 2 3// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the GNU Affero General Public License v3.0. 4// See the LICENCE file in the repository root for full licence text. 5 6declare(strict_types=1); 7 8namespace App\Transformers; 9 10use App\Models\DailyChallengeUserStats; 11 12class DailyChallengeUserStatsTransformer extends TransformerAbstract 13{ 14 public function transform(DailyChallengeUserStats $stats): array 15 { 16 return [ 17 'daily_streak_best' => $stats->daily_streak_best ?? 0, 18 'daily_streak_current' => $stats->daily_streak_current ?? 0, 19 'last_update' => json_time($stats->last_update), 20 'last_weekly_streak' => json_time($stats->last_weekly_streak), 21 'playcount' => $stats->playcount ?? 0, 22 'top_10p_placements' => $stats->top_10p_placements ?? 0, 23 'top_50p_placements' => $stats->top_50p_placements ?? 0, 24 'user_id' => $stats->user_id, 25 'weekly_streak_best' => $stats->weekly_streak_best ?? 0, 26 'weekly_streak_current' => $stats->weekly_streak_current ?? 0, 27 ]; 28 } 29}