@@ -186,7 +186,7 @@ discard block |
||
186 | 186 | */ |
187 | 187 | public function isAjax() |
188 | 188 | { |
189 | - return 'XMLHttpRequest' === Arrays::first((array) I::get($this->getHeaders(), 'x-requested-with', [])); |
|
189 | + return 'XMLHttpRequest' === Arrays::first((array)I::get($this->getHeaders(), 'x-requested-with', [])); |
|
190 | 190 | } |
191 | 191 | |
192 | 192 | /** |
@@ -381,9 +381,9 @@ discard block |
||
381 | 381 | $secure = $this->isSecureConnection(); |
382 | 382 | $http = $secure ? 'https' : 'http'; |
383 | 383 | if (I::get($this->getHeaders(), 'x-forwarded-host')) { |
384 | - $this->__hostInfo = $http . '://' . trim((string) Arrays::first(explode(',', (string) Arrays::first((array) I::get($this->getHeaders(), 'x-forward-host', []))))); |
|
384 | + $this->__hostInfo = $http . '://' . trim((string)Arrays::first(explode(',', (string)Arrays::first((array)I::get($this->getHeaders(), 'x-forward-host', []))))); |
|
385 | 385 | } elseif (I::get($this->getHeaders(), 'host')) { |
386 | - $this->__hostInfo = $http . '://' . Arrays::first((array) I::get($this->getHeaders(), 'host')); |
|
386 | + $this->__hostInfo = $http . '://' . Arrays::first((array)I::get($this->getHeaders(), 'host')); |
|
387 | 387 | } elseif (isset($_SERVER['SERVER_NAME'])) { |
388 | 388 | $this->__hostInfo = $http . '://' . $_SERVER['SERVER_NAME']; |
389 | 389 | $port = $secure ? $this->getSecurePort() : $this->getPort(); |
@@ -464,7 +464,7 @@ discard block |
||
464 | 464 | */ |
465 | 465 | public function getQueryString() |
466 | 466 | { |
467 | - return (string) I::get($_SERVER, 'QUERY_STRING', ''); |
|
467 | + return (string)I::get($_SERVER, 'QUERY_STRING', ''); |
|
468 | 468 | } |
469 | 469 | |
470 | 470 | /** |
@@ -478,7 +478,7 @@ discard block |
||
478 | 478 | return true; |
479 | 479 | } |
480 | 480 | foreach ($this->__secureProtocolHeaders as $header => $values) { |
481 | - if (($headerValue = (string) I::get($this->getHeaders(), $header)) !== null) { |
|
481 | + if (($headerValue = (string)I::get($this->getHeaders(), $header)) !== null) { |
|
482 | 482 | foreach ($values as $value) { |
483 | 483 | if (strcasecmp($headerValue, $value) === 0) { |
484 | 484 | return true; |
@@ -497,7 +497,7 @@ discard block |
||
497 | 497 | */ |
498 | 498 | public function getServerName() |
499 | 499 | { |
500 | - return (string) I::get($_SERVER, 'SERVER_NAME'); |
|
500 | + return (string)I::get($_SERVER, 'SERVER_NAME'); |
|
501 | 501 | } |
502 | 502 | |
503 | 503 | /** |
@@ -507,7 +507,7 @@ discard block |
||
507 | 507 | */ |
508 | 508 | public function getServerPort() |
509 | 509 | { |
510 | - return (int) I::get($_SERVER, 'SERVER_PORT'); |
|
510 | + return (int)I::get($_SERVER, 'SERVER_PORT'); |
|
511 | 511 | } |
512 | 512 | |
513 | 513 | /** |
@@ -517,7 +517,7 @@ discard block |
||
517 | 517 | */ |
518 | 518 | public function getReferrer() |
519 | 519 | { |
520 | - return Arrays::first((array) I::get($this->getHeaders(), 'referer')); |
|
520 | + return Arrays::first((array)I::get($this->getHeaders(), 'referer')); |
|
521 | 521 | } |
522 | 522 | |
523 | 523 | /** |
@@ -527,7 +527,7 @@ discard block |
||
527 | 527 | */ |
528 | 528 | public function getOrigin() |
529 | 529 | { |
530 | - return Arrays::first((array) I::get($this->getHeaders(), 'origin')); |
|
530 | + return Arrays::first((array)I::get($this->getHeaders(), 'origin')); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | /** |
@@ -537,7 +537,7 @@ discard block |
||
537 | 537 | */ |
538 | 538 | public function getUserAgent() |
539 | 539 | { |
540 | - return Arrays::first((array) I::get($this->getHeaders(), 'user-agent')); |
|
540 | + return Arrays::first((array)I::get($this->getHeaders(), 'user-agent')); |
|
541 | 541 | } |
542 | 542 | |
543 | 543 | /** |
@@ -549,7 +549,7 @@ discard block |
||
549 | 549 | { |
550 | 550 | foreach ($this->__ipHeaders as $ipHeader) { |
551 | 551 | if (I::get($this->getHeaders(), $ipHeader)) { |
552 | - return trim(Arrays::first(explode(',', Arrays::first((array) I::get($this->getHeaders(), $ipHeader))))); |
|
552 | + return trim(Arrays::first(explode(',', Arrays::first((array)I::get($this->getHeaders(), $ipHeader))))); |
|
553 | 553 | } |
554 | 554 | } |
555 | 555 | return $this->getRemoteIP(); |
@@ -562,7 +562,7 @@ discard block |
||
562 | 562 | */ |
563 | 563 | public function getRemoteIP() |
564 | 564 | { |
565 | - return (string) I::get($_SERVER, 'REMOTE_ADDR'); |
|
565 | + return (string)I::get($_SERVER, 'REMOTE_ADDR'); |
|
566 | 566 | } |
567 | 567 | |
568 | 568 | /** |
@@ -572,7 +572,7 @@ discard block |
||
572 | 572 | */ |
573 | 573 | public function getRemoteHost() |
574 | 574 | { |
575 | - return (string) I::get($_SERVER, 'REMOTE_HOST'); |
|
575 | + return (string)I::get($_SERVER, 'REMOTE_HOST'); |
|
576 | 576 | } |
577 | 577 | |
578 | 578 | /** |
@@ -585,7 +585,7 @@ discard block |
||
585 | 585 | if (isset($_SERVER['CONTENT_TYPE'])) { |
586 | 586 | return $_SERVER['CONTENT_TYPE']; |
587 | 587 | } |
588 | - return Arrays::first((array) I::get($this->getHeaders(), 'content-type')); |
|
588 | + return Arrays::first((array)I::get($this->getHeaders(), 'content-type')); |
|
589 | 589 | } |
590 | 590 | |
591 | 591 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | */ |
117 | 117 | public static function create() |
118 | 118 | { |
119 | - if (!static::$_instance instanceof static ) { |
|
119 | + if (!static::$_instance instanceof static) { |
|
120 | 120 | static::$_instance = new static(); |
121 | 121 | } |
122 | 122 | |
@@ -190,7 +190,7 @@ discard block |
||
190 | 190 | } |
191 | 191 | $value = I::get($data, $field); |
192 | 192 | $range = I::get($rule, 'range', []); |
193 | - $isStrict = (bool) I::get($rule, 'isStrict', false); |
|
193 | + $isStrict = (bool)I::get($rule, 'isStrict', false); |
|
194 | 194 | if (!in_array($value, $range, $isStrict)) { |
195 | 195 | $this->__messages[$field][] = I::get($rule, 'message', $field . ' 不在范围内'); |
196 | 196 | $this->__codes[$field][] = I::get($rule, 'code', self::CODE_VALIDATE_IN); |
@@ -202,8 +202,8 @@ discard block |
||
202 | 202 | if (!array_key_exists('pattern', $rule)) { |
203 | 203 | throw new Exception('pattern error'); |
204 | 204 | } |
205 | - $value = (string) I::get($data, $field); |
|
206 | - $pattern = (string) I::get($rule, 'pattern', '//'); |
|
205 | + $value = (string)I::get($data, $field); |
|
206 | + $pattern = (string)I::get($rule, 'pattern', '//'); |
|
207 | 207 | if (!preg_match($pattern, $value)) { |
208 | 208 | $this->__messages[$field][] = I::get($rule, 'message', $field . ' 格式不正确'); |
209 | 209 | $this->__codes[$field][] = I::get($rule, 'code', self::CODE_VALIDATE_MATCH); |