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;
9
10use App\Models\NewsPost;
11
12class NewsPostOpengraph implements OpengraphInterface
13{
14 public function __construct(private NewsPost $post)
15 {
16 }
17
18 public function get(): array
19 {
20 return [
21 'description' => $this->post->previewText(),
22 'image' => $this->post->firstImage(true),
23 'title' => $this->post->title(),
24 ];
25 }
26}