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