Passed
Push — main ( c7a6ed...5bba20 )
by Tan
05:19
created

ListPostResource   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 16
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 14 2
1
<?php
2
3
namespace CSlant\Blog\Api\Http\Resources;
4
5
use Botble\Blog\Http\Resources\ListPostResource as BaseListPostResource;
0 ignored issues
show
Bug introduced by
The type Botble\Blog\Http\Resources\ListPostResource 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...
6
use Botble\Blog\Http\Resources\TagResource;
0 ignored issues
show
Bug introduced by
The type Botble\Blog\Http\Resources\TagResource 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 Botble\Blog\Models\Post;
0 ignored issues
show
Bug introduced by
The type Botble\Blog\Models\Post 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...
8
use Botble\Media\Facades\RvMedia;
0 ignored issues
show
Bug introduced by
The type Botble\Media\Facades\RvMedia 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...
9
10
/**
11
 * @mixin Post
12
 */
13
class ListPostResource extends BaseListPostResource
14
{
15
    public function toArray($request): array
16
    {
17
        /** @var Post $this */
18
        return [
19
            'id' => $this->id,
20
            'name' => $this->name,
21
            'slug' => $this->slug,
22
            'description' => $this->description,
23
            'image' => $this->image ? RvMedia::url($this->image) : null,
24
            'categories' => CategoryResource::collection($this->categories),
25
            'tags' => TagResource::collection($this->tags),
26
            'author' => AuthorResource::make($this->author),
27
            'created_at' => $this->created_at,
28
            'updated_at' => $this->updated_at,
29
        ];
30
    }
31
}
32