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\Event;
9
10class EventTransformer extends TransformerAbstract
11{
12 public function transform(Event $event)
13 {
14 $event->parse();
15
16 return array_merge([
17 'created_at' => json_time($event->date),
18 'createdAt' => json_time($event->date), // TODO: remove when confirmed not used.
19 'id' => $event->getKey(),
20 'type' => $event->type,
21 ], $event->details);
22 }
23}