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\Genre;
9
10class GenreTransformer extends TransformerAbstract
11{
12 public function transform(Genre $genre)
13 {
14 $id = $genre->getKey();
15
16 return [
17 'id' => $id === 0 ? null : $id,
18 'name' => osu_trans('beatmaps.genre.'.strtr(strtolower($genre->name), ' ', '-')),
19 ];
20 }
21}