@@ -110,9 +110,8 @@ public function init()
110110
111111 protected function _handleInfo ($ info )
112112 {
113- return array_map (function ($ val )
114- {
115- return trim (strpos ($ val ,'; ' ) ? strchr ($ val ,'; ' , true ) : $ val );
113+ return array_map (function ($ val ) {
114+ return trim (strpos ($ val ,'; ' ) ? strstr ($ val ,'; ' , true ) : $ val );
116115 },
117116 (array ) explode (', ' , $ info )
118117 );
@@ -138,7 +137,7 @@ protected function _handleInfo($info)
138137 *
139138 * ]
140139 */
141- private $ _headers = null ;
140+ private $ _headers ;
142141
143142 /**
144143 * @return array|false|null
@@ -152,7 +151,7 @@ public function getHeaders()
152151 $ this ->_headers = http_get_request_headers ();
153152 } else {
154153 foreach ($ _SERVER as $ name => $ value ) {
155- if ( $ name = $ this ->_nameConver ($ name )) {
154+ if ( $ name = $ this ->_nameConvert ($ name )) {
156155 $ this ->_headers [$ name ] = $ value ;
157156 }
158157 }
@@ -185,14 +184,14 @@ public function getHeader($name, $default = null)
185184
186185 // HTTP_X_TOKEN => xToken
187186 // HTTP_USER_AGENT => userAgent
188- protected function _nameConver ($ string )
187+ protected function _nameConvert ($ string )
189188 {
190189 // if ( !strpos($string, '_') ) {
191190 // return strtolower($string);
192191 // }
193192
194193 if ( strpos ($ string ,'HTTP_ ' )!==false ) {
195- $ string = substr ($ string , strlen ('HTTP_ ' ));
194+ $ string = substr ($ string , strlen ('HTTP_ ' ));
196195 } else {
197196 return false ;
198197 }
@@ -239,9 +238,9 @@ protected function _userAgentCheck()
239238 //// system check
240239// $isLinux = $isMac = $isAndroid = false;
241240
242- if (preg_match ('/win/i ' , $ agent )) {
243-
241+ if (false !== strpos ($ agent , 'win ' ) ) {
244242 $ this ->set ('isWin ' , true );
243+ $ os = 'Windows other ' ;
245244
246245 if (preg_match ('/nt 6.0/i ' , $ agent )) {
247246 $ os = 'Windows Vista ' ;
@@ -255,10 +254,7 @@ protected function _userAgentCheck()
255254 $ os = 'Windows XP ' ;
256255 } else if (preg_match ('/nt 5/i ' , $ agent )) {
257256 $ os = 'Windows 2000 ' ;
258- } else {
259- $ os = 'Windows other ' ;
260257 }
261-
262258 } elseif (strpos ($ agent , 'linux ' )) {
263259
264260 if (strpos ($ agent , 'android ' )) {
@@ -340,7 +336,7 @@ protected function _userAgentCheck()
340336 * @from web
341337 * @return string
342338 */
343- public function getIP ()
339+ public function getIp ()
344340 {
345341 $ ip = '' ;
346342
@@ -366,4 +362,4 @@ public function getBrowsers()
366362 return get_browser ($ this ->get ('userAgent ' ),true );
367363 }
368364
369- }// end class Client
365+ }// end class Client
0 commit comments