@@ -84,8 +84,8 @@ |
||
| 84 | 84 | } |
| 85 | 85 | return $mixed; |
| 86 | 86 | } elseif (is_string($mixed) || is_numeric($mixed)) { // 字符串或数字 |
| 87 | - $pos = (int) $keyString; |
|
| 88 | - $length = null === $defaultValue ? 1 : (int) $defaultValue; |
|
| 87 | + $pos = (int)$keyString; |
|
| 88 | + $length = null === $defaultValue ? 1 : (int)$defaultValue; |
|
| 89 | 89 | return Strings::sub($mixed, $pos, $length); |
| 90 | 90 | } elseif (null === $mixed) { // null |
| 91 | 91 | return $defaultValue; |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | */ |
| 80 | 80 | public static function toBytes($size) |
| 81 | 81 | { |
| 82 | - $callback = function ($matches) { |
|
| 82 | + $callback = function($matches) { |
|
| 83 | 83 | $sizeMap = [ |
| 84 | 84 | '' => 0, |
| 85 | 85 | 'b' => 0, // 为了简化正则 |
@@ -93,7 +93,7 @@ discard block |
||
| 93 | 93 | return $matches[1] * pow(1024, $sizeMap[strtolower($matches[2])]); |
| 94 | 94 | }; |
| 95 | 95 | |
| 96 | - return (int) preg_replace_callback('/(\d*)\s*([a-z]?)b?/i', $callback, $size, 1); |
|
| 96 | + return (int)preg_replace_callback('/(\d*)\s*([a-z]?)b?/i', $callback, $size, 1); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | /** |
@@ -156,7 +156,7 @@ discard block |
||
| 156 | 156 | if ($toBaseInput == '0123456789') { |
| 157 | 157 | $retval = 0; |
| 158 | 158 | for ($i = 1; $i <= $numberLen; $i++) { |
| 159 | - $retval = bcadd($retval, bcmul((string) array_search($number[$i - 1], $fromBase), bcpow($fromLen, $numberLen - $i))); |
|
| 159 | + $retval = bcadd($retval, bcmul((string)array_search($number[$i - 1], $fromBase), bcpow($fromLen, $numberLen - $i))); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | return $retval; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | $zoomWidth *= $this->_attributes['width']; |
| 152 | 152 | $zoomHeight *= $this->_attributes['height']; |
| 153 | 153 | } else { |
| 154 | - $zoom = (int) $zoom; |
|
| 154 | + $zoom = (int)$zoom; |
|
| 155 | 155 | $zoomWidth = $zoom * $this->_attributes['width']; |
| 156 | 156 | $zoomHeight = $zoom * $this->_attributes['height']; |
| 157 | 157 | } |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * |
| 298 | 298 | * @return \icy2003\php\ihelpers\Color Color 类对象 |
| 299 | 299 | */ |
| 300 | - public function getColor($x, $y){ |
|
| 300 | + public function getColor($x, $y) { |
|
| 301 | 301 | $rgb = imagecolorat($this->_attributes['object'], $x, $y); |
| 302 | 302 | return new Color([($rgb >> 16) & 0xFF, ($rgb >> 8) & 0xFF, $rgb & 0xFF], Color::TYPE_RGB); |
| 303 | 303 | } |
@@ -174,7 +174,7 @@ discard block |
||
| 174 | 174 | public static function combine($keys, $values) |
| 175 | 175 | { |
| 176 | 176 | if (count($keys) == count($values)) { |
| 177 | - return (array) array_combine($keys, $values); |
|
| 177 | + return (array)array_combine($keys, $values); |
|
| 178 | 178 | } |
| 179 | 179 | $array = []; |
| 180 | 180 | foreach ($keys as $index => $key) { |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | } else { |
| 489 | 489 | $function = $callback; |
| 490 | 490 | if (false === is_callable($callback)) { |
| 491 | - $function = function ($row) use ($callback, $isStrict) { |
|
| 491 | + $function = function($row) use ($callback, $isStrict) { |
|
| 492 | 492 | return true === $isStrict ? $row === $callback : $row == $callback; |
| 493 | 493 | }; |
| 494 | 494 | } |
@@ -905,7 +905,7 @@ discard block |
||
| 905 | 905 | return in_array($value, $array, $isStrict); |
| 906 | 906 | } else { |
| 907 | 907 | $value = Json::decode(strtolower(Json::encode($value))); |
| 908 | - $array = (array) Json::decode(strtolower(Json::encode($array))); |
|
| 908 | + $array = (array)Json::decode(strtolower(Json::encode($array))); |
|
| 909 | 909 | return in_array($value, $array, $isStrict); |
| 910 | 910 | } |
| 911 | 911 | } |