1 | <?php |
||
8 | class WebResourceOwner implements ResourceOwnerInterface |
||
9 | { |
||
10 | /** |
||
11 | * Raw response |
||
12 | * |
||
13 | * @var array |
||
14 | */ |
||
15 | protected $response; |
||
16 | |||
17 | /** |
||
18 | * Creates new resource owner. |
||
19 | * |
||
20 | * @param array $response |
||
21 | */ |
||
22 | 6 | public function __construct(array $response = array()) |
|
26 | |||
27 | /** |
||
28 | * 普通用户的标识,对当前开发者帐号唯一 |
||
29 | * |
||
30 | * @return string|null |
||
31 | */ |
||
32 | 3 | public function getId() |
|
36 | |||
37 | /** |
||
38 | * 普通用户昵称 |
||
39 | * |
||
40 | * @return string|null |
||
41 | */ |
||
42 | 3 | public function getNickname() |
|
46 | |||
47 | /** |
||
48 | * 普通用户性别,1为男性,2为女性 |
||
49 | * |
||
50 | * @return string|null |
||
51 | */ |
||
52 | 3 | public function getSex() |
|
56 | |||
57 | /** |
||
58 | * 普通用户个人资料填写的省份 |
||
59 | * |
||
60 | * @return string|null |
||
61 | */ |
||
62 | 3 | public function getProvince() |
|
63 | { |
||
64 | 3 | return $this->response['province'] ?: null; |
|
65 | } |
||
66 | |||
67 | /** |
||
68 | * 普通用户个人资料填写的城市 |
||
69 | * |
||
70 | * @return string|null |
||
71 | */ |
||
72 | 3 | public function getCity() |
|
76 | |||
77 | /** |
||
78 | * 国家,如中国为CN |
||
79 | * |
||
80 | * @return string|null |
||
81 | */ |
||
82 | 3 | public function getCountry() |
|
86 | |||
87 | /** |
||
88 | * 用户头像,最后一个数值代表正方形头像大小(有0、46、64、96、132数值可选,0代表640*640正方形头像),用户没有头像时该项为空 |
||
89 | * |
||
90 | * @return string|null |
||
91 | */ |
||
92 | 3 | public function getHeadImgUrl() |
|
93 | { |
||
94 | 3 | return $this->response['headimgurl'] ?: null; |
|
95 | } |
||
96 | |||
97 | /** |
||
98 | * 用户特权信息,json数组,如微信沃卡用户为(chinaunicom) |
||
99 | * |
||
100 | * @return string|null |
||
101 | */ |
||
102 | 3 | public function getPrivilege() |
|
106 | |||
107 | /** |
||
108 | * 用户统一标识。针对一个微信开放平台帐号下的应用,同一用户的unionid是唯一的 |
||
109 | * |
||
110 | * @return string|null |
||
111 | */ |
||
112 | 3 | public function getUnionId() |
|
113 | { |
||
114 | 3 | return $this->response['unionid'] ?: null; |
|
115 | } |
||
116 | |||
117 | /** |
||
118 | * Return all of the owner details available as an array. |
||
119 | * |
||
120 | * @return array |
||
121 | */ |
||
122 | public function toArray() |
||
126 | } |
||
127 |