the browser-facing portion of osu!
at master 42 lines 1.5 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 6namespace App\Transformers; 7 8use App\Models\Beatmap; 9 10class BeatmapTransformer extends BeatmapCompactTransformer 11{ 12 protected $beatmapsetTransformer = BeatmapsetTransformer::class; 13 protected $requiredPermission = 'BeatmapShow'; 14 15 protected array $defaultIncludes = [ 16 'checksum', 17 ]; 18 19 public function transform(Beatmap $beatmap) 20 { 21 return array_merge(parent::transform($beatmap), [ 22 'accuracy' => $beatmap->diff_overall, 23 'ar' => $beatmap->diff_approach, 24 'bpm' => $beatmap->bpm, 25 'convert' => $beatmap->convert, 26 'count_circles' => $beatmap->countNormal, 27 'count_sliders' => $beatmap->countSlider, 28 'count_spinners' => $beatmap->countSpinner, 29 'cs' => $beatmap->diff_size, 30 'deleted_at' => $beatmap->deleted_at_json, 31 'drain' => $beatmap->diff_drain, 32 'hit_length' => $beatmap->hit_length, 33 'is_scoreable' => $beatmap->isScoreable(), 34 'last_updated' => $beatmap->last_update_json, 35 'mode_int' => $beatmap->playmode, 36 'passcount' => $beatmap->passcount, 37 'playcount' => $beatmap->playcount, 38 'ranked' => $beatmap->approved, 39 'url' => route('beatmaps.show', ['beatmap' => $beatmap->getKey()]), 40 ]); 41 } 42}