Passed
Push — master ( b1742c...4b0d05 )
by Arthur
101:17 queued 94:42
created

UserTransformer::transformPermissions()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
/**
3
 * Created by PhpStorm.
4
 * User: arthur
5
 * Date: 29.10.18
6
 * Time: 12:06.
7
 */
8
9
namespace Modules\User\Transformers;
10
11
use Foundation\Abstracts\Transformers\Transformer;
12
use Modules\Authorization\Transformers\RoleTransformer;
13
14
class UserTransformer extends Transformer
15
{
16
    public $include = [
17
        'roles',
18
        'permissions',
19
    ];
20
21
    /**
22
     * Transform the resource into an array.
23
     *
24
     * @param \Illuminate\Http\Request $request
25
     *
26
     * @return array
27
     */
28
    public function toArray($request)
29
    {
30 3
        return [
31
            'id'             => $this->id,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Modules\User\Transformers\UserTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
32
            'name'           => $this->name,
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on Modules\User\Transformers\UserTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
33 3
            'email'          => $this->name,
34 3
            'email_verified' => $this->email_verified,
0 ignored issues
show
Bug Best Practice introduced by
The property email_verified does not exist on Modules\User\Transformers\UserTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
35 3
            'gender'         => $this->gender,
0 ignored issues
show
Bug Best Practice introduced by
The property gender does not exist on Modules\User\Transformers\UserTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
36 3
            'provider'       => $this->provider,
0 ignored issues
show
Bug Best Practice introduced by
The property provider does not exist on Modules\User\Transformers\UserTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
37 3
            'roles'          => collect(RoleTransformer::collection($this->whenLoaded('roles'))->serialize())->flatten(),
38 3
            'created_at'     => $this->created_at,
0 ignored issues
show
Bug Best Practice introduced by
The property created_at does not exist on Modules\User\Transformers\UserTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
39 3
            'updated_at'     => $this->updated_at,
0 ignored issues
show
Bug Best Practice introduced by
The property updated_at does not exist on Modules\User\Transformers\UserTransformer. Since you implemented __get, consider adding a @property annotation.
Loading history...
40 3
        ];
41
    }
42
}
43