Passed
Pull Request — main (#80)
by Tan
03:17 queued 20s
created

ListCommentResource   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 7
c 1
b 0
f 0
dl 0
loc 16
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 9 1
1
<?php
2
3
namespace CSlant\Blog\Api\Http\Resources\Comment;
4
5
use CSlant\Blog\Api\Http\Resources\Author\AuthorResource;
6
use CSlant\Blog\Core\Models\Comment;
7
use Illuminate\Http\Resources\Json\JsonResource;
8
9
/**
10
 * @mixin Comment
11
 */
12
class ListCommentResource extends JsonResource
13
{
14
    /**
15
     * @param $request
16
     *
17
     * @return array<string, mixed>
18
     */
19
    public function toArray($request): array
20
    {
21
        /** @var Comment $this */
22
        return [
23
            'id' => $this->id,
24
            'website' => $this->website,
25
            'content' => $this->content,
26
            'status' => $this->status,
27
            'author' => AuthorResource::make($this->author),
28
        ];
29
    }
30
}
31