@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | 'scope' => $this->config['scope'], |
34 | 34 | 'state' => $this->config['state'] ?: Str::random(), |
35 | 35 | ]; |
36 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
36 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | /** |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | 'channel' => ConstCode::TYPE_LINE, |
58 | 58 | 'nickname' => $result['displayName'], |
59 | 59 | 'gender' => ConstCode::GENDER, //line不返回性别信息 |
60 | - 'avatar' => isset($result['pictureUrl']) ? $result['pictureUrl'] . '/large' : '', |
|
60 | + 'avatar' => isset($result['pictureUrl']) ? $result['pictureUrl'].'/large' : '', |
|
61 | 61 | ]; |
62 | 62 | return $userInfo; |
63 | 63 | } |
@@ -90,10 +90,10 @@ discard block |
||
90 | 90 | $method = strtoupper($method); |
91 | 91 | $request = [ |
92 | 92 | 'method' => $method, |
93 | - 'uri' => self::API_BASE . $api, |
|
93 | + 'uri' => self::API_BASE.$api, |
|
94 | 94 | ]; |
95 | 95 | |
96 | - $headers = ['Authorization' => $this->token['token_type'] . ' ' . $this->token['access_token']]; |
|
96 | + $headers = ['Authorization' => $this->token['token_type'].' '.$this->token['access_token']]; |
|
97 | 97 | |
98 | 98 | $data = $this->$method($request['uri'], $params, $headers); |
99 | 99 |
@@ -21,21 +21,21 @@ discard block |
||
21 | 21 | */ |
22 | 22 | class Douyin extends Gateway |
23 | 23 | { |
24 | - protected $ApiBase = 'https://open.douyin.com'; |
|
24 | + protected $ApiBase = 'https://open.douyin.com'; |
|
25 | 25 | protected $AuthorizeURL = 'https://open.douyin.com/platform/oauth/connect/'; |
26 | - protected $AuthorizeSilenceURL = 'https://open.douyin.com/oauth/authorize/v2/';//抖音静默授权 |
|
26 | + protected $AuthorizeSilenceURL = 'https://open.douyin.com/oauth/authorize/v2/'; //抖音静默授权 |
|
27 | 27 | protected $AccessTokenURL = 'oauth/access_token/'; |
28 | 28 | protected $UserInfoURL = 'oauth/userinfo/'; |
29 | 29 | |
30 | 30 | protected $jsCode2Session = 'https://minigame.zijieapi.com/mgplatform/api/apps/jscode2session'; |
31 | 31 | |
32 | 32 | protected $API_BASE_ARRAY = [ |
33 | - 'douyin'=>'https://open.douyin.com/',//抖音 |
|
34 | - 'toutiao'=>'https://open.snssdk.com/',//头条 |
|
35 | - 'xigua'=>'https://open-api.ixigua.com/',//西瓜 |
|
33 | + 'douyin'=>'https://open.douyin.com/', //抖音 |
|
34 | + 'toutiao'=>'https://open.snssdk.com/', //头条 |
|
35 | + 'xigua'=>'https://open-api.ixigua.com/', //西瓜 |
|
36 | 36 | ]; |
37 | 37 | |
38 | - public $oauth_type = ConstCode::TYPE_DOUYIN;//抖音 |
|
38 | + public $oauth_type = ConstCode::TYPE_DOUYIN; //抖音 |
|
39 | 39 | |
40 | 40 | /** |
41 | 41 | * Description: 得到跳转地址 |
@@ -55,17 +55,17 @@ discard block |
||
55 | 55 | 'redirect_uri' => $this->config['callback'], |
56 | 56 | 'response_type' => $this->config['response_type'], |
57 | 57 | 'scope' => $this->config['scope'], |
58 | - 'optionalScope' => $this->config['optionalScope']??'', |
|
58 | + 'optionalScope' => $this->config['optionalScope'] ?? '', |
|
59 | 59 | 'state' => $this->config['state'], |
60 | 60 | ]; |
61 | - if($params['state'] == 'login_id'){ |
|
61 | + if ($params['state'] == 'login_id') { |
|
62 | 62 | /** |
63 | 63 | * 抖音静默获取授权码 |
64 | 64 | * https://developer.open-douyin.com/docs/resource/zh-CN/dop/develop/openapi/account-permission/douyin-default-get-permission-code |
65 | 65 | */ |
66 | - return $this->AuthorizeSilenceURL . '?' . http_build_query($params); |
|
67 | - }else{ |
|
68 | - return $this->AuthorizeURL . '?' . http_build_query($params); |
|
66 | + return $this->AuthorizeSilenceURL.'?'.http_build_query($params); |
|
67 | + } else { |
|
68 | + return $this->AuthorizeURL.'?'.http_build_query($params); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
@@ -105,11 +105,11 @@ discard block |
||
105 | 105 | 'open_id' => $this->openid(), |
106 | 106 | 'union_id'=> isset($this->token['unionid']) ? $this->token['unionid'] : '', |
107 | 107 | 'channel' => $this->oauth_type, |
108 | - 'nickname'=> $result['nickname']??'', |
|
108 | + 'nickname'=> $result['nickname'] ?? '', |
|
109 | 109 | 'gender' => isset($result['gender']) ? $result['gender'] : ConstCode::GENDER, |
110 | - 'avatar' => $result['avatar']??'', |
|
110 | + 'avatar' => $result['avatar'] ?? '', |
|
111 | 111 | ]; |
112 | - $userInfo['type'] = ConstCode::getTypeConst($userInfo['channel'],$this->type); |
|
112 | + $userInfo['type'] = ConstCode::getTypeConst($userInfo['channel'], $this->type); |
|
113 | 113 | return $userInfo; |
114 | 114 | } |
115 | 115 | |
@@ -122,15 +122,15 @@ discard block |
||
122 | 122 | */ |
123 | 123 | public function getUserInfo() |
124 | 124 | { |
125 | - if($this->type == 'app'){//App登录 |
|
126 | - if(!isset($_REQUEST['access_token']) ){ |
|
125 | + if ($this->type == 'app') {//App登录 |
|
126 | + if (!isset($_REQUEST['access_token'])) { |
|
127 | 127 | throw new \Exception("Douyin APP登录 需要传输access_token参数! "); |
128 | 128 | } |
129 | 129 | $this->token['access_token'] = $_REQUEST['access_token']; |
130 | - }elseif ($this->type == 'applets'){ |
|
130 | + }elseif ($this->type == 'applets') { |
|
131 | 131 | //小程序 |
132 | 132 | return $this->applets(); |
133 | - }else { |
|
133 | + } else { |
|
134 | 134 | /** 获取token信息 */ |
135 | 135 | $this->getToken(); |
136 | 136 | } |
@@ -149,12 +149,12 @@ discard block |
||
149 | 149 | * @return array|mixed|null |
150 | 150 | * @throws \Exception |
151 | 151 | */ |
152 | - public function applets(){ |
|
152 | + public function applets() { |
|
153 | 153 | /** 获取参数 */ |
154 | 154 | $params = $this->jscode2sessionParams(); |
155 | 155 | |
156 | 156 | /** 获取access_token */ |
157 | - $token = $this->get($this->jsCode2Session, $params); |
|
157 | + $token = $this->get($this->jsCode2Session, $params); |
|
158 | 158 | /** 解析token值(子类实现此方法) */ |
159 | 159 | $this->token = $this->parseToken($token); |
160 | 160 | return $this->token; |
@@ -167,10 +167,10 @@ discard block |
||
167 | 167 | */ |
168 | 168 | private function switchAccessTokenURL() |
169 | 169 | { |
170 | - switch ($this->oauth_type){ |
|
171 | - case ConstCode::TYPE_DOUYIN:$this->ApiBase = $this->API_BASE_ARRAY['douyin'];break; |
|
172 | - case ConstCode::TYPE_TOUTIAO:$this->ApiBase = $this->API_BASE_ARRAY['toutiao'];break; |
|
173 | - case ConstCode::TYPE_XIGUA:$this->ApiBase = $this->API_BASE_ARRAY['xigua'];break; |
|
170 | + switch ($this->oauth_type) { |
|
171 | + case ConstCode::TYPE_DOUYIN:$this->ApiBase = $this->API_BASE_ARRAY['douyin']; break; |
|
172 | + case ConstCode::TYPE_TOUTIAO:$this->ApiBase = $this->API_BASE_ARRAY['toutiao']; break; |
|
173 | + case ConstCode::TYPE_XIGUA:$this->ApiBase = $this->API_BASE_ARRAY['xigua']; break; |
|
174 | 174 | default:throw new \Exception("获取抖音 OAUTH_TYPE 参数出错:{$this->oauth_type}"); |
175 | 175 | } |
176 | 176 | $this->AccessTokenURL = $this->ApiBase.$this->AccessTokenURL; |
@@ -207,8 +207,8 @@ discard block |
||
207 | 207 | 'appid' => $this->config['app_id'], |
208 | 208 | 'secret' => $this->config['app_secret'], |
209 | 209 | ]; |
210 | - if(isset($_REQUEST['code'])) $params['code'] = $_REQUEST['code']; |
|
211 | - if(isset($_REQUEST['anonymous_code'])) $params['anonymous_code'] = $_REQUEST['anonymous_code']; |
|
210 | + if (isset($_REQUEST['code'])) $params['code'] = $_REQUEST['code']; |
|
211 | + if (isset($_REQUEST['anonymous_code'])) $params['anonymous_code'] = $_REQUEST['anonymous_code']; |
|
212 | 212 | |
213 | 213 | return $params; |
214 | 214 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | $data = json_decode($token, true); |
227 | 227 | if (isset($data['data']['access_token'])) { |
228 | 228 | return $data['data']; |
229 | - }elseif (isset($data['session_key'])){ |
|
229 | + }elseif (isset($data['session_key'])) { |
|
230 | 230 | //小程序登录 |
231 | 231 | return $data; |
232 | 232 | } else { |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | */ |
35 | 35 | protected static function init($gateway, $config) |
36 | 36 | { |
37 | - if(empty($config)){ |
|
37 | + if (empty($config)) { |
|
38 | 38 | throw new \Exception("第三方登录 [$gateway] config配置不能为空"); |
39 | 39 | } |
40 | 40 | $baseConfig = [ |
@@ -44,14 +44,14 @@ discard block |
||
44 | 44 | 'scope' => '', |
45 | 45 | 'type' => '', |
46 | 46 | ]; |
47 | - if($gateway == 'weixin'){ |
|
47 | + if ($gateway == 'weixin') { |
|
48 | 48 | /** 兼容 tinymeng/oauth v1.0.0完美升级 */ |
49 | 49 | $gateway = 'wechat'; |
50 | 50 | } |
51 | 51 | $gateway = Str::uFirst($gateway); |
52 | - $class = __NAMESPACE__ . '\\Gateways\\' . $gateway; |
|
52 | + $class = __NAMESPACE__.'\\Gateways\\'.$gateway; |
|
53 | 53 | if (class_exists($class)) { |
54 | - $app = new $class(array_replace_recursive($baseConfig,$config)); |
|
54 | + $app = new $class(array_replace_recursive($baseConfig, $config)); |
|
55 | 55 | if ($app instanceof GatewayInterface) { |
56 | 56 | return $app; |
57 | 57 | } |
@@ -27,7 +27,7 @@ discard block |
||
27 | 27 | $this->saveState(); |
28 | 28 | //登录参数 |
29 | 29 | $oauthToken = $this->call('oauth/request_token', ['oauth_callback' => $this->config['callback']], 'POST'); |
30 | - return self::API_BASE . 'oauth/authenticate?oauth_token=' . $oauthToken['oauth_token']; |
|
30 | + return self::API_BASE.'oauth/authenticate?oauth_token='.$oauthToken['oauth_token']; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -66,7 +66,7 @@ discard block |
||
66 | 66 | if (isset($this->token['oauth_token_secret'])) { |
67 | 67 | $this->tokenSecret = $this->token['oauth_token_secret']; |
68 | 68 | } else { |
69 | - throw new \Exception("获取Twitter ACCESS_TOKEN 出错:" . json_encode($this->token)); |
|
69 | + throw new \Exception("获取Twitter ACCESS_TOKEN 出错:".json_encode($this->token)); |
|
70 | 70 | } |
71 | 71 | } |
72 | 72 | |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | $method = strtoupper($method); |
87 | 87 | $request = [ |
88 | 88 | 'method' => $method, |
89 | - 'uri' => self::API_BASE . $api, |
|
89 | + 'uri' => self::API_BASE.$api, |
|
90 | 90 | ]; |
91 | 91 | $oauthParams = $this->getOAuthParams($params); |
92 | 92 | $oauthParams['oauth_signature'] = $this->signature($request, $oauthParams); |
@@ -131,8 +131,8 @@ discard block |
||
131 | 131 | { |
132 | 132 | ksort($params); |
133 | 133 | $sign_str = Str::buildParams($params, true); |
134 | - $sign_str = $request['method'] . '&' . rawurlencode($request['uri']) . '&' . rawurlencode($sign_str); |
|
135 | - $sign_key = $this->config['app_secret'] . '&' . $this->tokenSecret; |
|
134 | + $sign_str = $request['method'].'&'.rawurlencode($request['uri']).'&'.rawurlencode($sign_str); |
|
135 | + $sign_key = $this->config['app_secret'].'&'.$this->tokenSecret; |
|
136 | 136 | |
137 | 137 | return rawurlencode(base64_encode(hash_hmac('sha1', $sign_str, $sign_key, true))); |
138 | 138 | } |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | { |
148 | 148 | $return = 'OAuth '; |
149 | 149 | foreach ($params as $k => $param) { |
150 | - $return .= $k . '="' . $param . '", '; |
|
150 | + $return .= $k.'="'.$param.'", '; |
|
151 | 151 | } |
152 | 152 | return rtrim($return, ', '); |
153 | 153 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | * 解析access_token方法请求后的返回值 |
169 | 169 | * @param string $token 获取access_token的方法的返回值 |
170 | 170 | */ |
171 | - protected function parseToken($token){ |
|
171 | + protected function parseToken($token) { |
|
172 | 172 | return $token; |
173 | 173 | } |
174 | 174 | } |
@@ -6,16 +6,16 @@ discard block |
||
6 | 6 | |
7 | 7 | use tinymeng\tools\Tool; |
8 | 8 | |
9 | -class ConstCode{ |
|
9 | +class ConstCode { |
|
10 | 10 | |
11 | 11 | /** 公共状态 */ |
12 | - const STATUS_DELETE = 0;//删除 |
|
13 | - const STATUS_NORMAL = 1;//正常 |
|
12 | + const STATUS_DELETE = 0; //删除 |
|
13 | + const STATUS_NORMAL = 1; //正常 |
|
14 | 14 | |
15 | 15 | /** 性别 */ |
16 | - const GENDER = 0;//未知 |
|
17 | - const GENDER_MAN = 1;//男 |
|
18 | - const GENDER_WOMEN = 2;//女 |
|
16 | + const GENDER = 0; //未知 |
|
17 | + const GENDER_MAN = 1; //男 |
|
18 | + const GENDER_WOMEN = 2; //女 |
|
19 | 19 | |
20 | 20 | /** 登录类型 */ |
21 | 21 | const TYPE_QQ = 1; //QQ |
@@ -27,8 +27,8 @@ discard block |
||
27 | 27 | const TYPE_FACEBOOK = 7; //faceBook |
28 | 28 | const TYPE_GOOGLE = 8; //google |
29 | 29 | const TYPE_TWITTER = 9; //飞鸽 |
30 | - const TYPE_LINE = 10;//line |
|
31 | - const TYPE_NAVER = 11;//naver |
|
30 | + const TYPE_LINE = 10; //line |
|
31 | + const TYPE_NAVER = 11; //naver |
|
32 | 32 | |
33 | 33 | const TYPE_QQ_APP = 21; //qqAPP |
34 | 34 | const TYPE_WECHAT_APP = 22; //微信APP |
@@ -46,24 +46,24 @@ discard block |
||
46 | 46 | * @param bool $type 类型:app applets |
47 | 47 | * @return int |
48 | 48 | */ |
49 | - static public function getTypeConst($channel,$type="") |
|
49 | + static public function getTypeConst($channel, $type = "") |
|
50 | 50 | { |
51 | - switch ($channel){ |
|
51 | + switch ($channel) { |
|
52 | 52 | case self::TYPE_QQ: |
53 | - if($type == 'app'){ |
|
54 | - $typeConst = self::TYPE_QQ_APP;//qqApp |
|
55 | - }else{ |
|
53 | + if ($type == 'app') { |
|
54 | + $typeConst = self::TYPE_QQ_APP; //qqApp |
|
55 | + } else { |
|
56 | 56 | $typeConst = $channel; |
57 | 57 | } |
58 | 58 | break; |
59 | 59 | case self::TYPE_WECHAT: |
60 | - if($type == 'app'){ |
|
61 | - $typeConst = self::TYPE_WECHAT_APP;//微信App |
|
62 | - }else if($type == 'applets'){ |
|
63 | - $typeConst = self::TYPE_WECHAT_APPLETS;//微信小程序 |
|
64 | - }else if(Tool::isWeiXin()){ |
|
65 | - $typeConst = self::TYPE_WECHAT_MOBILE;//微信mobile |
|
66 | - }else{ |
|
60 | + if ($type == 'app') { |
|
61 | + $typeConst = self::TYPE_WECHAT_APP; //微信App |
|
62 | + } else if ($type == 'applets') { |
|
63 | + $typeConst = self::TYPE_WECHAT_APPLETS; //微信小程序 |
|
64 | + } else if (Tool::isWeiXin()) { |
|
65 | + $typeConst = self::TYPE_WECHAT_MOBILE; //微信mobile |
|
66 | + } else { |
|
67 | 67 | $typeConst = $channel; |
68 | 68 | } |
69 | 69 | break; |
@@ -85,7 +85,7 @@ discard block |
||
85 | 85 | if (!$config) { |
86 | 86 | throw new \Exception('传入的配置不能为空'); |
87 | 87 | } |
88 | - if(isset($_GET['referer']) && $config['callback']){ |
|
88 | + if (isset($_GET['referer']) && $config['callback']) { |
|
89 | 89 | $config['callback'] .= ((strpos($config['callback'], '?') !== false) ? '&' : '?').'referer='.$_GET['referer']; |
90 | 90 | } |
91 | 91 | //默认参数 |
@@ -98,11 +98,11 @@ discard block |
||
98 | 98 | 'proxy' => '', |
99 | 99 | 'state' => '', |
100 | 100 | 'type' => '', |
101 | - 'is_sandbox' => false,//是否是沙箱环境 |
|
101 | + 'is_sandbox' => false, //是否是沙箱环境 |
|
102 | 102 | ]; |
103 | - $this->config = array_merge($_config, $config); |
|
104 | - foreach($this->config as $key=>$val){ |
|
105 | - if(property_exists($this,$key)) $this->$key=$val; |
|
103 | + $this->config = array_merge($_config, $config); |
|
104 | + foreach ($this->config as $key=>$val) { |
|
105 | + if (property_exists($this, $key)) $this->$key = $val; |
|
106 | 106 | } |
107 | 107 | $this->timestamp = time(); |
108 | 108 | } |
@@ -138,7 +138,7 @@ discard block |
||
138 | 138 | * Updater: |
139 | 139 | * @return $this |
140 | 140 | */ |
141 | - public function mustCheckState(){ |
|
141 | + public function mustCheckState() { |
|
142 | 142 | $this->checkState = true; |
143 | 143 | return $this; |
144 | 144 | } |
@@ -148,7 +148,7 @@ discard block |
||
148 | 148 | * @Author: TinyMeng <[email protected]> |
149 | 149 | * @return array |
150 | 150 | */ |
151 | - public function getConfig(){ |
|
151 | + public function getConfig() { |
|
152 | 152 | return $this->config; |
153 | 153 | } |
154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * @param $token |
158 | 158 | * @return $this |
159 | 159 | */ |
160 | - public function setToken($token){ |
|
160 | + public function setToken($token) { |
|
161 | 161 | $this->token = $token; |
162 | 162 | return $this; |
163 | 163 | } |
@@ -166,14 +166,14 @@ discard block |
||
166 | 166 | * 存储state |
167 | 167 | * @Author: TinyMeng <[email protected]> |
168 | 168 | */ |
169 | - public function saveState(){ |
|
169 | + public function saveState() { |
|
170 | 170 | if ($this->checkState === true) { |
171 | 171 | //是否开启session |
172 | 172 | if (session_status() !== PHP_SESSION_ACTIVE) { |
173 | 173 | session_start(); |
174 | 174 | } |
175 | - if(empty($this->config['state'])){ |
|
176 | - $this->config['state'] = Str::random();//生成随机state |
|
175 | + if (empty($this->config['state'])) { |
|
176 | + $this->config['state'] = Str::random(); //生成随机state |
|
177 | 177 | } |
178 | 178 | //存储到session |
179 | 179 | $_SESSION['tinymeng_oauth_state'] = $this->config['state']; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | * @Author: TinyMeng <[email protected]> |
186 | 186 | * @throws \Exception |
187 | 187 | */ |
188 | - public function CheckState(){ |
|
188 | + public function CheckState() { |
|
189 | 189 | if ($this->checkState === true) { |
190 | 190 | if (session_status() !== PHP_SESSION_ACTIVE) { |
191 | 191 | session_start(); |
@@ -202,7 +202,7 @@ discard block |
||
202 | 202 | * Updater: |
203 | 203 | * @return array |
204 | 204 | */ |
205 | - protected function accessTokenParams(){ |
|
205 | + protected function accessTokenParams() { |
|
206 | 206 | $params = [ |
207 | 207 | 'client_id' => $this->config['app_id'], |
208 | 208 | 'client_secret' => $this->config['app_secret'], |
@@ -218,7 +218,7 @@ discard block |
||
218 | 218 | * @author: JiaMeng <[email protected]> |
219 | 219 | * Updater: |
220 | 220 | */ |
221 | - protected function getToken(){ |
|
221 | + protected function getToken() { |
|
222 | 222 | if (empty($this->token)) { |
223 | 223 | /** 验证state参数 */ |
224 | 224 | $this->CheckState(); |
@@ -227,7 +227,7 @@ discard block |
||
227 | 227 | $params = $this->accessTokenParams(); |
228 | 228 | |
229 | 229 | /** 获取access_token */ |
230 | - $token = $this->POST($this->AccessTokenURL, $params); |
|
230 | + $token = $this->POST($this->AccessTokenURL, $params); |
|
231 | 231 | /** 解析token值(子类实现此方法) */ |
232 | 232 | $this->token = $this->parseToken($token); |
233 | 233 | } |
@@ -244,7 +244,7 @@ discard block |
||
244 | 244 | */ |
245 | 245 | protected function get($url, $params = [], $headers = []) |
246 | 246 | { |
247 | - return \tinymeng\tools\HttpRequest::httpGet($url, $params,$headers); |
|
247 | + return \tinymeng\tools\HttpRequest::httpGet($url, $params, $headers); |
|
248 | 248 | } |
249 | 249 | |
250 | 250 | /** |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | */ |
259 | 259 | protected function post($url, $params = [], $headers = []) |
260 | 260 | { |
261 | - $headers[] = 'Accept: application/json';//GitHub需要的header |
|
262 | - return \tinymeng\tools\HttpRequest::httpPost($url, $params,$headers); |
|
261 | + $headers[] = 'Accept: application/json'; //GitHub需要的header |
|
262 | + return \tinymeng\tools\HttpRequest::httpPost($url, $params, $headers); |
|
263 | 263 | } |
264 | 264 | |
265 | 265 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * M代表男性,F代表女性 |
268 | 268 | * @param $gender |
269 | 269 | */ |
270 | - public function getGender($gender){ |
|
271 | - return strtolower(substr($gender , 0 , 1)) == 'm' ? ConstCode::GENDER_MAN : ConstCode::GENDER_WOMEN; |
|
270 | + public function getGender($gender) { |
|
271 | + return strtolower(substr($gender, 0, 1)) == 'm' ? ConstCode::GENDER_MAN : ConstCode::GENDER_WOMEN; |
|
272 | 272 | } |
273 | 273 | } |