@@ -37,15 +37,15 @@ |
||
| 37 | 37 | public function __construct($mchid, $appid, $apiKey) |
| 38 | 38 | { |
| 39 | 39 | $this->_mchId = $mchid; |
| 40 | - if(null === $this->_mchId){ |
|
| 40 | + if (null === $this->_mchId) { |
|
| 41 | 41 | throw new Exception("缺少商户号"); |
| 42 | 42 | } |
| 43 | 43 | $this->_appId = $appid; |
| 44 | - if(null === $this->_appId){ |
|
| 44 | + if (null === $this->_appId) { |
|
| 45 | 45 | throw new Exception("缺少应用 ID"); |
| 46 | 46 | } |
| 47 | 47 | $this->_apiKey = $apiKey; |
| 48 | - if(null === $this->_apiKey){ |
|
| 48 | + if (null === $this->_apiKey) { |
|
| 49 | 49 | throw new Exception("缺少密钥"); |
| 50 | 50 | } |
| 51 | 51 | } |
@@ -83,6 +83,6 @@ |
||
| 83 | 83 | public static function toFile($string, $file = null) |
| 84 | 84 | { |
| 85 | 85 | null === $file && $file = './Base64_toFile_' . date('YmdHis') . '.txt'; |
| 86 | - return (bool) file_put_contents($file, base64_decode($string)); |
|
| 86 | + return (bool)file_put_contents($file, base64_decode($string)); |
|
| 87 | 87 | } |
| 88 | 88 | } |
@@ -53,9 +53,9 @@ discard block |
||
| 53 | 53 | $promise = $client->requestAsync('GET', $url, [ |
| 54 | 54 | 'query' => $get, |
| 55 | 55 | ]); |
| 56 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
| 56 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
| 57 | 57 | $success && $success($res->getBody()->getContents(), $res); |
| 58 | - }, function (RequestException $err) use ($error) { |
|
| 58 | + }, function(RequestException $err) use ($error) { |
|
| 59 | 59 | $error && $error($err); |
| 60 | 60 | }); |
| 61 | 61 | } |
@@ -99,9 +99,9 @@ discard block |
||
| 99 | 99 | 'query' => $get, |
| 100 | 100 | 'form_params' => $post, |
| 101 | 101 | ]); |
| 102 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
| 102 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
| 103 | 103 | $success && $success($res->getBody()->getContents(), $res); |
| 104 | - }, function (RequestException $err) use ($error) { |
|
| 104 | + }, function(RequestException $err) use ($error) { |
|
| 105 | 105 | $error && $error($err); |
| 106 | 106 | }); |
| 107 | 107 | } |
@@ -145,9 +145,9 @@ discard block |
||
| 145 | 145 | 'query' => $get, |
| 146 | 146 | 'body' => $body, |
| 147 | 147 | ]); |
| 148 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
| 148 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
| 149 | 149 | $success && $success($res->getBody()->getContents(), $res); |
| 150 | - }, function (RequestException $err) use ($error) { |
|
| 150 | + }, function(RequestException $err) use ($error) { |
|
| 151 | 151 | $error && $error($err); |
| 152 | 152 | }); |
| 153 | 153 | } |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | */ |
| 140 | 140 | public static function ul($array) |
| 141 | 141 | { |
| 142 | - return implode(PHP_EOL, array_map(function ($row) { |
|
| 142 | + return implode(PHP_EOL, array_map(function($row) { |
|
| 143 | 143 | return '- ' . self::__text($row); |
| 144 | 144 | }, $array)); |
| 145 | 145 | } |
@@ -155,7 +155,7 @@ discard block |
||
| 155 | 155 | */ |
| 156 | 156 | public static function ol($array) |
| 157 | 157 | { |
| 158 | - return implode(PHP_EOL, array_map(function ($row) { |
|
| 158 | + return implode(PHP_EOL, array_map(function($row) { |
|
| 159 | 159 | static $i = 1; |
| 160 | 160 | return ($i++) . '. ' . self::__text($row); |
| 161 | 161 | }, $array)); |
@@ -210,8 +210,8 @@ discard block |
||
| 210 | 210 | $title = array_shift($array); |
| 211 | 211 | $rows = $array; |
| 212 | 212 | } |
| 213 | - $lineFunc = function ($arr) { |
|
| 214 | - return '|' . implode('|', array_map(function ($line) { |
|
| 213 | + $lineFunc = function($arr) { |
|
| 214 | + return '|' . implode('|', array_map(function($line) { |
|
| 215 | 215 | return ' ' . self::__text($line) . ' '; |
| 216 | 216 | }, $arr)) . '|'; |
| 217 | 217 | }; |
@@ -91,7 +91,7 @@ |
||
| 91 | 91 | if (false === static::isJson($json)) { |
| 92 | 92 | $json = '[]'; |
| 93 | 93 | } |
| 94 | - echo $json;die; |
|
| 94 | + echo $json; die; |
|
| 95 | 95 | } |
| 96 | 96 | |
| 97 | 97 | /** |
@@ -116,7 +116,7 @@ |
||
| 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 | |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $sizeMap = [ |
| 51 | 51 | '' => 0, |
| 52 | 52 | 'b' => 0, // 为了简化正则 |
| 53 | - 'k' => 1, |
|
| 53 | + 'k' => 1, |
|
| 54 | 54 | 'm' => 2, |
| 55 | 55 | 'g' => 3, |
| 56 | 56 | 't' => 4, |
@@ -46,7 +46,7 @@ |
||
| 46 | 46 | */ |
| 47 | 47 | public static function size($sizeValue) |
| 48 | 48 | { |
| 49 | - $callback = function ($matches) { |
|
| 49 | + $callback = function($matches) { |
|
| 50 | 50 | $sizeMap = [ |
| 51 | 51 | '' => 0, |
| 52 | 52 | 'b' => 0, // 为了简化正则 |
@@ -27,7 +27,7 @@ discard block |
||
| 27 | 27 | public function __construct($image) |
| 28 | 28 | { |
| 29 | 29 | $attributes = $this->__parseImage($image); |
| 30 | - array_map(function ($value, $key) { |
|
| 30 | + array_map(function($value, $key) { |
|
| 31 | 31 | $this->_attributes[$key] = $value; |
| 32 | 32 | }, array_values($attributes), array_keys($attributes)); |
| 33 | 33 | $this->_imageIn = $this->_attributes['object']; |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $zoomWidth *= $this->_attributes['width']; |
| 151 | 151 | $zoomHeight *= $this->_attributes['height']; |
| 152 | 152 | } else { |
| 153 | - $zoom = (int) $zoom; |
|
| 153 | + $zoom = (int)$zoom; |
|
| 154 | 154 | $zoomWidth = $zoom * $this->_attributes['width']; |
| 155 | 155 | $zoomHeight = $zoom * $this->_attributes['height']; |
| 156 | 156 | } |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | */ |
| 51 | 51 | public static function create($config = []) |
| 52 | 52 | { |
| 53 | - if (!static::$_instance instanceof static ) { |
|
| 53 | + if (!static::$_instance instanceof static) { |
|
| 54 | 54 | static::$_instance = new static(); |
| 55 | 55 | static::$_instance->__formName = I::get($config, 'formName', 'file'); |
| 56 | 56 | static::$_instance->__sizeLimit = static::$_instance->__getSizeLimit(I::get($config, 'sizeLimit', 0)); |