the browser-facing portion of osu!
at master 25 lines 693 B 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 6namespace App\Transformers; 7 8use App\Models\UserBadge; 9 10class UserBadgeTransformer extends TransformerAbstract 11{ 12 public function transform(UserBadge $badge) 13 { 14 $imageUrl = $badge->imageUrl(); 15 $image2xUrl = retinaify($imageUrl); 16 17 return [ 18 'awarded_at' => json_time($badge->awarded), 19 'description' => $badge->description, 20 'image@2x_url' => $image2xUrl, 21 'image_url' => $imageUrl, 22 'url' => $badge->url, 23 ]; 24 } 25}