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

AuthorResource::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
eloc 6
c 2
b 1
f 0
dl 0
loc 9
rs 10
cc 1
nc 1
nop 1
1
<?php
2
3
namespace CSlant\Blog\Api\Http\Resources;
4
5
use Botble\Blog\Models\Category;
0 ignored issues
show
Bug introduced by
The type Botble\Blog\Models\Category 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 CSlant\Blog\Core\Models\User;
7
use Illuminate\Http\Resources\Json\JsonResource;
8
9
/**
10
 * @mixin Category
11
 */
12
class AuthorResource extends JsonResource
13
{
14
    /**  */
15
    public function toArray($request): array
16
    {
17
        /** @var User $this */
18
        return [
19
            'id' => $this->id,
20
            'first_name' => $this->first_name,
21
            'last_name' => $this->last_name,
22
            'image' => $this->avatar_url,
23
            'roles' => $this->roles,
24
        ];
25
    }
26
}
27