1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace AdamPaterson\OAuth2\Client\Provider; |
4
|
|
|
|
5
|
|
|
use League\OAuth2\Client\Provider\ResourceOwnerInterface; |
6
|
|
|
|
7
|
|
|
/** |
8
|
|
|
* Class SlackResourceOwner |
9
|
|
|
* |
10
|
|
|
* @author Adam Paterson <[email protected]> |
11
|
|
|
* |
12
|
|
|
* @package AdamPaterson\OAuth2\Client\Provider |
13
|
|
|
*/ |
14
|
|
|
class SlackResourceOwner implements ResourceOwnerInterface |
15
|
|
|
{ |
16
|
|
|
|
17
|
|
|
protected $response; |
18
|
|
|
|
19
|
3 |
|
public function __construct(array $response) |
20
|
|
|
{ |
21
|
3 |
|
$this->response = $response; |
22
|
3 |
|
} |
23
|
|
|
|
24
|
|
|
/** |
25
|
|
|
* Return all of the owner details available as an array. |
26
|
|
|
* |
27
|
|
|
* @return array |
28
|
|
|
*/ |
29
|
3 |
|
public function toArray() |
30
|
|
|
{ |
31
|
3 |
|
return $this->response; |
32
|
|
|
} |
33
|
|
|
|
34
|
3 |
|
public function getId() |
35
|
|
|
{ |
36
|
3 |
|
return $this->response['user']['id'] ?: null; |
37
|
|
|
} |
38
|
|
|
|
39
|
|
|
|
40
|
3 |
|
public function getName() |
41
|
|
|
{ |
42
|
3 |
|
return $this->response['user']['name'] ?: null; |
43
|
|
|
} |
44
|
|
|
|
45
|
3 |
|
public function isDeleted() |
46
|
|
|
{ |
47
|
3 |
|
return $this->response['user']['deleted'] ?: null; |
48
|
|
|
} |
49
|
|
|
|
50
|
3 |
|
public function getColor() |
51
|
|
|
{ |
52
|
3 |
|
return $this->response['user']['color'] ?: null; |
53
|
|
|
} |
54
|
|
|
|
55
|
3 |
|
public function getProfile() |
56
|
|
|
{ |
57
|
3 |
|
return $this->response['user']['profile'] ?: null; |
58
|
|
|
} |
59
|
|
|
|
60
|
3 |
|
public function getFirstName() |
61
|
|
|
{ |
62
|
3 |
|
return $this->response['user']['profile']['first_name'] ?: null; |
63
|
|
|
} |
64
|
|
|
|
65
|
3 |
|
public function getLastName() |
66
|
|
|
{ |
67
|
3 |
|
return $this->response['user']['profile']['last_name'] ?: null; |
68
|
|
|
} |
69
|
|
|
|
70
|
3 |
|
public function getRealName() |
71
|
|
|
{ |
72
|
3 |
|
return $this->response['user']['profile']['real_name'] ?: null; |
73
|
|
|
} |
74
|
|
|
|
75
|
3 |
|
public function getEmail() |
76
|
|
|
{ |
77
|
3 |
|
return $this->response['user']['profile']['email'] ?: null; |
78
|
|
|
} |
79
|
|
|
|
80
|
3 |
|
public function getSkype() |
81
|
|
|
{ |
82
|
3 |
|
return $this->response['user']['profile']['skype'] ?: null; |
83
|
|
|
} |
84
|
|
|
|
85
|
3 |
|
public function getPhone() |
86
|
|
|
{ |
87
|
3 |
|
return $this->response['user']['profile']['phone'] ?: null; |
88
|
|
|
} |
89
|
|
|
|
90
|
3 |
|
public function getImage24() |
91
|
|
|
{ |
92
|
3 |
|
return $this->response['user']['profile']['image_24'] ?: null; |
93
|
|
|
} |
94
|
|
|
|
95
|
3 |
|
public function getImage32() |
96
|
|
|
{ |
97
|
3 |
|
return $this->response['user']['profile']['image_32'] ?: null; |
98
|
|
|
} |
99
|
|
|
|
100
|
3 |
|
public function getImage48() |
101
|
|
|
{ |
102
|
3 |
|
return $this->response['user']['profile']['image_48'] ?: null; |
103
|
|
|
} |
104
|
|
|
|
105
|
3 |
|
public function getImage72() |
106
|
|
|
{ |
107
|
3 |
|
return $this->response['user']['profile']['image_72'] ?: null; |
108
|
|
|
} |
109
|
|
|
|
110
|
3 |
|
public function getImage192() |
111
|
|
|
{ |
112
|
3 |
|
return $this->response['user']['profile']['image_192'] ?: null; |
113
|
|
|
} |
114
|
|
|
|
115
|
3 |
|
public function isAdmin() |
116
|
|
|
{ |
117
|
3 |
|
return $this->response['user']['is_admin'] ?: null; |
118
|
|
|
} |
119
|
|
|
|
120
|
3 |
|
public function isOwner() |
121
|
|
|
{ |
122
|
3 |
|
return $this->response['user']['is_owner'] ?: null; |
123
|
|
|
} |
124
|
|
|
|
125
|
3 |
|
public function hasTwoFactorAuthentication() |
126
|
|
|
{ |
127
|
3 |
|
return $this->response['user']['has_2fa'] ?: null; |
128
|
|
|
} |
129
|
|
|
|
130
|
3 |
|
public function hasFiles() |
131
|
|
|
{ |
132
|
3 |
|
return $this->response['user']['has_files'] ?: null; |
133
|
|
|
} |
134
|
|
|
} |
135
|
|
|
|