Passed
Push — main ( 9cf148...e49e83 )
by José
11:57 queued 09:45
created

User::getLinks()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace CrudSys\OAuth2\Client\Entity;
4
5
use League\OAuth2\Client\Provider\ResourceOwnerInterface;
6
use League\OAuth2\Client\Tool\ArrayAccessorTrait;
7
8
class User implements ResourceOwnerInterface
9
{
10
    use ArrayAccessorTrait;
11
12
    /**
13
     * Raw response
14
     *
15
     */
16
    protected array $response;
17
18
    /**
19
     * @param array $response
20
     */
21
    public function __construct(array $response)
22
    {
23
        $this->response = $response;
24
    }
25
26
    public function toArray(): array
27
    {
28
        return $this->response;
29
    }
30
31
    public function getId(): string
32
    {
33
        return $this->getValueByKey($this->response, 'id');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...($this->response, 'id') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
34
    }
35
36
    public function getUsername(): string
37
    {
38
        return $this->getValueByKey($this->response, 'username');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...->response, 'username') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
39
    }
40
41
    public function isPatron(): bool
42
    {
43
        return $this->getValueByKey($this->response, 'patron');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...is->response, 'patron') could return the type null which is incompatible with the type-hinted return boolean. Consider adding an additional type-check to rule them out.
Loading history...
44
    }
45
46
    public function isOnline(): bool
47
    {
48
        return $this->getValueByKey($this->response, 'online');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...is->response, 'online') could return the type null which is incompatible with the type-hinted return boolean. Consider adding an additional type-check to rule them out.
Loading history...
49
    }
50
51
    public function getProfile(): array
52
    {
53
        return $this->getValueByKey($this->response, 'profile');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...s->response, 'profile') could return the type null which is incompatible with the type-hinted return array. Consider adding an additional type-check to rule them out.
Loading history...
54
    }
55
56
    public function getCountry(): string
57
    {
58
        return $this->getValueByKey($this->response, 'profile.country');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...nse, 'profile.country') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
59
    }
60
61
    public function getLocation(): string
62
    {
63
        return $this->getValueByKey($this->response, 'profile.location');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...se, 'profile.location') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
64
    }
65
66
    public function getBio(): string
67
    {
68
        return $this->getValueByKey($this->response, 'profile.bio');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...esponse, 'profile.bio') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
69
    }
70
71
    public function getFirstName(): string
72
    {
73
        return $this->getValueByKey($this->response, 'profile.firstName');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...e, 'profile.firstName') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
74
    }
75
76
    public function getLastName(): string
77
    {
78
        return $this->getValueByKey($this->response, 'profile.lastName');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...se, 'profile.lastName') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
79
    }
80
81
    public function getLinks(): string
82
    {
83
        return $this->getValueByKey($this->response, 'profile.links');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...ponse, 'profile.links') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
84
    }
85
86
    public function getUrl(): string
87
    {
88
        return $this->getValueByKey($this->response, 'url');
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this->getValueBy...$this->response, 'url') could return the type null which is incompatible with the type-hinted return string. Consider adding an additional type-check to rule them out.
Loading history...
89
    }
90
91
    public function getCompletionRate()
92
    {
93
        return $this->getValueByKey($this->response, 'completionRate');
94
    }
95
}
96