Passed
Push — main ( c8aeab...201fc1 )
by Tan
03:18 queued 16s
created

CommentResource   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 7
dl 0
loc 16
rs 10
c 0
b 0
f 0
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\Request;
8
use Illuminate\Http\Resources\Json\JsonResource;
9
10
/**
11
 * @mixin Comment
12
 */
13
class CommentResource extends JsonResource
14
{
15
    /**
16
     * @param  Request  $request
17
     *
18
     * @return array<string, mixed>
19
     */
20
    public function toArray(Request $request): array
21
    {
22
        /** @var Comment $this */
23
        return [
24
            'id' => $this->id,
25
            'website' => $this->website,
26
            'content' => $this->content,
27
            'status' => $this->status,
28
            'author' => AuthorResource::make($this->author),
29
        ];
30
    }
31
}
32