Test Failed
Push — master ( ffc71e...1a0a2f )
by Koen
03:32
created

UserResource   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 6
dl 0
loc 19
rs 10
c 0
b 0
f 0
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 6 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace App\Http\Resources\Api;
6
7
use Illuminate\Http\Resources\Json\JsonResource;
0 ignored issues
show
Bug introduced by
The type Illuminate\Http\Resources\Json\JsonResource 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
9
final class UserResource extends JsonResource
10
{
11
    /**
12
     * @var \App\Models\User
13
     */
14
    public $resource;
15
16
    /**
17
     * Transform the resource into an array.
18
     *
19
     * @param  \Illuminate\Http\Request $request
0 ignored issues
show
Bug introduced by
The type Illuminate\Http\Request 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...
20
     * @return array
21
     */
22
    public function toArray($request)
23
    {
24
        return [
25
            'id'    => $this->resource->getKey(),
26
            'name'  => $this->resource->getAttribute('name'),
27
            'email' => $this->resource->getAttribute('email'),
28
        ];
29
    }
30
}
31