Passed
Pull Request — main (#80)
by
unknown
03:54
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 FriendsOfBotble\Comment\Models\Comment;
0 ignored issues
show
Bug introduced by
The type FriendsOfBotble\Comment\Models\Comment was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
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