the browser-facing portion of osu!
at master 861 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 6declare(strict_types=1); 7 8namespace App\Libraries\Opengraph\Forum; 9 10use App\Libraries\Opengraph\OpengraphInterface; 11use App\Models\Forum\Topic; 12 13class TopicOpengraph implements OpengraphInterface 14{ 15 public function __construct(private Topic $topic) 16 { 17 } 18 19 public function get(): array 20 { 21 $forumDescription = (new ForumOpengraph($this->topic->forum))->description(); 22 23 return [ 24 'description' => "{$forumDescription} » {$this->topic->topic_title}", 25 'image' => $this->topic->cover?->file()->url() ?? $this->topic->forum->cover?->defaultTopicCover->url(), 26 'title' => $this->topic->topic_title, 27 ]; 28 } 29}