mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-20 20:13:17 +00:00
21 lines
549 B
PHP
21 lines
549 B
PHP
<?php
|
|
|
|
namespace App\Transformer\Api\Mastodon\v1;
|
|
|
|
use App\Profile;
|
|
use League\Fractal;
|
|
|
|
class MentionTransformer extends Fractal\TransformerAbstract
|
|
{
|
|
public function transform(Profile $profile)
|
|
{
|
|
$local = $profile->domain == null;
|
|
$username = $local ? $profile->username : explode('@', substr($profile->username, 1))[0];
|
|
return [
|
|
'id' => (string) $profile->id,
|
|
'url' => $profile->url(),
|
|
'username' => $profile->username,
|
|
'acct' => $username,
|
|
];
|
|
}
|
|
}
|