Passed
Push — master ( 51edae...d29a9b )
by Curtis
11:52 queued 05:54
created

User   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 18
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 9
c 1
b 0
f 0
dl 0
loc 18
rs 10
wmc 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A toArray() 0 10 1
1
<?php
2
3
namespace App\Http\Resources\enso\core;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
use App\Http\Resources\enso\avatars\Avatar;
7
use App\Http\Resources\enso\people\Person;
8
use App\Http\Resources\enso\roles\Role;
9
10
class User extends JsonResource
11
{
12
    /**
13
     * Transform the resource into an array.
14
     *
15
     * @param  \Illuminate\Http\Request  $request
16
     * @return array
17
     */
18
    public function toArray($request)
19
    {
20
        return [
21
            'id' => $this->id,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on App\Http\Resources\enso\core\User. Since you implemented __get, consider adding a @property annotation.
Loading history...
22
            'isActive' => $this->is_active,
0 ignored issues
show
Bug Best Practice introduced by
The property is_active does not exist on App\Http\Resources\enso\core\User. Since you implemented __get, consider adding a @property annotation.
Loading history...
23
            'email' => $this->email,
0 ignored issues
show
Bug Best Practice introduced by
The property email does not exist on App\Http\Resources\enso\core\User. Since you implemented __get, consider adding a @property annotation.
Loading history...
24
            'person' => new Person($this->whenLoaded('person')),
25
            'avatar' => new Avatar($this->whenLoaded('avatar')),
26
            'role' => new Role($this->whenLoaded('role')),
27
            'group' => new Group($this->whenLoaded('group')),
28
        ];
29
    }
30
}