1
0
Fork 1
mirror of https://github.com/pixelfed/pixelfed.git synced 2024-12-27 02:06:52 +00:00
pixelfed/app/Transformer/Api/ResultsTransformer.php

43 lines
767 B
PHP
Raw Normal View History

2018-12-31 04:26:37 +00:00
<?php
namespace App\Transformer\Api;
use League\Fractal;
class ResultsTransformer extends Fractal\TransformerAbstract
{
protected $defaultIncludes = [
2019-01-12 20:58:35 +00:00
'accounts',
'statuses',
'hashtags',
2018-12-31 04:26:37 +00:00
];
2019-01-12 20:58:35 +00:00
public function transform($results)
2018-12-31 04:26:37 +00:00
{
return [
'accounts' => [],
'statuses' => [],
'hashtags' => []
];
}
2019-01-12 20:58:35 +00:00
public function includeAccounts($results)
{
$accounts = $results->accounts;
return $this->collection($accounts, new AccountTransformer());
}
public function includeStatuses($results)
{
$statuses = $results->statuses;
return $this->collection($statuses, new StatusTransformer());
}
public function includeTags($results)
{
$hashtags = $status->hashtags;
return $this->collection($hashtags, new HashtagTransformer());
}
2018-12-31 04:26:37 +00:00
}