Passed
Push — master ( 58d207...d4720a )
by Paul
07:20
created

AccessToken::toArray()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 11
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 13
rs 9.9
1
<?php
2
3
namespace Devpri\Tinre\Http\Resources\Web;
4
5
use Illuminate\Http\Resources\Json\JsonResource;
6
7
class AccessToken extends JsonResource
8
{
9
    /**
10
     * Transform the resource into an array.
11
     *
12
     * @param  \Illuminate\Http\Request  $request
13
     * @return array
14
     */
15
    public function toArray($request)
16
    {
17
        return [
18
            'id' => $this->id,
0 ignored issues
show
Bug Best Practice introduced by
The property id does not exist on Devpri\Tinre\Http\Resources\Web\AccessToken. Since you implemented __get, consider adding a @property annotation.
Loading history...
19
            'name' => $this->name,
0 ignored issues
show
Bug Best Practice introduced by
The property name does not exist on Devpri\Tinre\Http\Resources\Web\AccessToken. Since you implemented __get, consider adding a @property annotation.
Loading history...
20
            'permissions' => $this->permissions,
0 ignored issues
show
Bug Best Practice introduced by
The property permissions does not exist on Devpri\Tinre\Http\Resources\Web\AccessToken. Since you implemented __get, consider adding a @property annotation.
Loading history...
21
            'user' => new User($this->whenLoaded('user')),
22
            'user_id' => $this->user_id,
0 ignored issues
show
Bug Best Practice introduced by
The property user_id does not exist on Devpri\Tinre\Http\Resources\Web\AccessToken. Since you implemented __get, consider adding a @property annotation.
Loading history...
23
            'last_used_at' => $this->last_used_at,
0 ignored issues
show
Bug Best Practice introduced by
The property last_used_at does not exist on Devpri\Tinre\Http\Resources\Web\AccessToken. Since you implemented __get, consider adding a @property annotation.
Loading history...
24
            'created_at' => $this->created_at,
0 ignored issues
show
Bug Best Practice introduced by
The property created_at does not exist on Devpri\Tinre\Http\Resources\Web\AccessToken. Since you implemented __get, consider adding a @property annotation.
Loading history...
25
            'updated_at' => $this->updated_at,
0 ignored issues
show
Bug Best Practice introduced by
The property updated_at does not exist on Devpri\Tinre\Http\Resources\Web\AccessToken. Since you implemented __get, consider adding a @property annotation.
Loading history...
26
            'plain_text_token' => $this->when($this->plain_text_token, $this->plain_text_token),
0 ignored issues
show
Bug Best Practice introduced by
The property plain_text_token does not exist on Devpri\Tinre\Http\Resources\Web\AccessToken. Since you implemented __get, consider adding a @property annotation.
Loading history...
27
            'authorized_actions' => $this->authorizedActions(),
0 ignored issues
show
Bug introduced by
The method authorizedActions() does not exist on Devpri\Tinre\Http\Resources\Web\AccessToken. Since you implemented __call, consider adding a @method annotation. ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

27
            'authorized_actions' => $this->/** @scrutinizer ignore-call */ authorizedActions(),
Loading history...
28
        ];
29
    }
30
}
31