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\Libraries\User;
9
10use App\Models\User;
11
12class UserSignatures
13{
14 private array $html = [];
15
16 public function get(User $user): ?string
17 {
18 $userId = $user->getKey();
19
20 if (!array_key_exists($userId, $this->html)) {
21 $sig = $user->user_sig;
22
23 $this->html[$userId] = present($sig)
24 ? bbcode($user->user_sig, $user->user_sig_bbcode_uid)
25 : null;
26 }
27
28 return $this->html[$userId];
29 }
30}