@@ -55,9 +55,9 @@ discard block |
||
| 55 | 55 | $promise = $client->requestAsync('GET', $url, [ |
| 56 | 56 | 'query' => $get, |
| 57 | 57 | ]); |
| 58 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
| 58 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
| 59 | 59 | $success && $success($res->getBody()->getContents(), $res); |
| 60 | - }, function (RequestException $err) use ($error) { |
|
| 60 | + }, function(RequestException $err) use ($error) { |
|
| 61 | 61 | $error && $error($err); |
| 62 | 62 | }); |
| 63 | 63 | } |
@@ -101,9 +101,9 @@ discard block |
||
| 101 | 101 | 'query' => $get, |
| 102 | 102 | 'form_params' => $post, |
| 103 | 103 | ]); |
| 104 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
| 104 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
| 105 | 105 | $success && $success($res->getBody()->getContents(), $res); |
| 106 | - }, function (RequestException $err) use ($error) { |
|
| 106 | + }, function(RequestException $err) use ($error) { |
|
| 107 | 107 | $error && $error($err); |
| 108 | 108 | }); |
| 109 | 109 | } |
@@ -147,9 +147,9 @@ discard block |
||
| 147 | 147 | 'query' => $get, |
| 148 | 148 | 'body' => $body, |
| 149 | 149 | ]); |
| 150 | - $promise->then(function (ResponseInterface $res) use ($success) { |
|
| 150 | + $promise->then(function(ResponseInterface $res) use ($success) { |
|
| 151 | 151 | $success && $success($res->getBody()->getContents(), $res); |
| 152 | - }, function (RequestException $err) use ($error) { |
|
| 152 | + }, function(RequestException $err) use ($error) { |
|
| 153 | 153 | $error && $error($err); |
| 154 | 154 | }); |
| 155 | 155 | } |
@@ -168,12 +168,12 @@ discard block |
||
| 168 | 168 | public function download($file) |
| 169 | 169 | { |
| 170 | 170 | list($from, $to) = (new LocalFile())->fileMap($file); |
| 171 | - try{ |
|
| 171 | + try { |
|
| 172 | 172 | (new Http())->get($from, [], [ |
| 173 | 173 | 'save_to' => I::getAlias($to), |
| 174 | 174 | ]); |
| 175 | 175 | return true; |
| 176 | - }catch(RequestException $e){ |
|
| 176 | + } catch (RequestException $e) { |
|
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -173,7 +173,7 @@ |
||
| 173 | 173 | 'save_to' => I::getAlias($to), |
| 174 | 174 | ]); |
| 175 | 175 | return true; |
| 176 | - }catch(RequestException $e){ |
|
| 176 | + } catch(RequestException $e){ |
|
| 177 | 177 | return false; |
| 178 | 178 | } |
| 179 | 179 | } |
@@ -219,7 +219,7 @@ discard block |
||
| 219 | 219 | */ |
| 220 | 220 | public static function moveCursorUp($rows = 1) |
| 221 | 221 | { |
| 222 | - echo '\033[' . (int) $rows . 'A'; |
|
| 222 | + echo '\033[' . (int)$rows . 'A'; |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | /** |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | */ |
| 234 | 234 | public static function moveCursorDown($rows = 1) |
| 235 | 235 | { |
| 236 | - echo '\033[' . (int) $rows . 'B'; |
|
| 236 | + echo '\033[' . (int)$rows . 'B'; |
|
| 237 | 237 | } |
| 238 | 238 | |
| 239 | 239 | /** |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | */ |
| 248 | 248 | public static function moveCursorForward($steps = 1) |
| 249 | 249 | { |
| 250 | - echo '\033[' . (int) $steps . 'C'; |
|
| 250 | + echo '\033[' . (int)$steps . 'C'; |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | /** |
@@ -261,7 +261,7 @@ discard block |
||
| 261 | 261 | */ |
| 262 | 262 | public static function moveCursorBackward($steps = 1) |
| 263 | 263 | { |
| 264 | - echo '\033[' . (int) $steps . 'D'; |
|
| 264 | + echo '\033[' . (int)$steps . 'D'; |
|
| 265 | 265 | } |
| 266 | 266 | |
| 267 | 267 | /** |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | */ |
| 274 | 274 | public static function moveCursorNextLine($lines = 1) |
| 275 | 275 | { |
| 276 | - echo '\033[' . (int) $lines . 'E'; |
|
| 276 | + echo '\033[' . (int)$lines . 'E'; |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | /** |
@@ -285,7 +285,7 @@ discard block |
||
| 285 | 285 | */ |
| 286 | 286 | public static function moveCursorPrevLine($lines = 1) |
| 287 | 287 | { |
| 288 | - echo '\033[' . (int) $lines . 'F'; |
|
| 288 | + echo '\033[' . (int)$lines . 'F'; |
|
| 289 | 289 | } |
| 290 | 290 | |
| 291 | 291 | /** |
@@ -299,9 +299,9 @@ discard block |
||
| 299 | 299 | public static function moveCursorTo($column, $row = null) |
| 300 | 300 | { |
| 301 | 301 | if ($row === null) { |
| 302 | - echo '\033[' . (int) $column . 'G'; |
|
| 302 | + echo '\033[' . (int)$column . 'G'; |
|
| 303 | 303 | } else { |
| 304 | - echo '\033[' . (int) $row . ';' . (int) $column . 'H'; |
|
| 304 | + echo '\033[' . (int)$row . ';' . (int)$column . 'H'; |
|
| 305 | 305 | } |
| 306 | 306 | } |
| 307 | 307 | |
@@ -316,7 +316,7 @@ discard block |
||
| 316 | 316 | */ |
| 317 | 317 | public static function scrollUp($lines = 1) |
| 318 | 318 | { |
| 319 | - echo '\033[' . (int) $lines . 'S'; |
|
| 319 | + echo '\033[' . (int)$lines . 'S'; |
|
| 320 | 320 | } |
| 321 | 321 | |
| 322 | 322 | /** |
@@ -330,7 +330,7 @@ discard block |
||
| 330 | 330 | */ |
| 331 | 331 | public static function scrollDown($lines = 1) |
| 332 | 332 | { |
| 333 | - echo '\033[' . (int) $lines . 'T'; |
|
| 333 | + echo '\033[' . (int)$lines . 'T'; |
|
| 334 | 334 | } |
| 335 | 335 | |
| 336 | 336 | /** |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | public function dayRange($offset = 0, $time = null) |
| 39 | 39 | { |
| 40 | 40 | null === $time && $time = time(); |
| 41 | - $y = (int) (date('Y', $time)); |
|
| 42 | - $m = (int) (date('m', $time)); |
|
| 43 | - $d = (int) (date('d', $time) + $offset); |
|
| 41 | + $y = (int)(date('Y', $time)); |
|
| 42 | + $m = (int)(date('m', $time)); |
|
| 43 | + $d = (int)(date('d', $time) + $offset); |
|
| 44 | 44 | return [ |
| 45 | 45 | mktime(0, 0, 0, $m, $d, $y), |
| 46 | 46 | mktime(23, 59, 59, $m, $d, $y), |
@@ -60,7 +60,7 @@ discard block |
||
| 60 | 60 | public function weekRange($offset = 0, $time = null) |
| 61 | 61 | { |
| 62 | 62 | null === $time && $time = time(); |
| 63 | - $offset = (int) $offset; |
|
| 63 | + $offset = (int)$offset; |
|
| 64 | 64 | return [ |
| 65 | 65 | strtotime(date('Y-m-d', strtotime('Sunday ' . ($offset - 1) . ' week', $time))), |
| 66 | 66 | strtotime(date('Y-m-d', strtotime('Saturday ' . $offset . ' week', $time))) + 24 * 3600 - 1, |
@@ -78,10 +78,10 @@ discard block |
||
| 78 | 78 | public function monthRange($offset = 0, $time = null) |
| 79 | 79 | { |
| 80 | 80 | null === $time && $time = time(); |
| 81 | - $y = (int) (date('Y', $time)); |
|
| 82 | - $m = (int) (date('m', $time) + $offset); |
|
| 81 | + $y = (int)(date('Y', $time)); |
|
| 82 | + $m = (int)(date('m', $time) + $offset); |
|
| 83 | 83 | $begin = mktime(0, 0, 0, $m, 1, $y); |
| 84 | - $end = mktime(23, 59, 59, $m, (int) date('t', $begin), $y); |
|
| 84 | + $end = mktime(23, 59, 59, $m, (int)date('t', $begin), $y); |
|
| 85 | 85 | |
| 86 | 86 | return [$begin, $end]; |
| 87 | 87 | } |
@@ -97,7 +97,7 @@ discard block |
||
| 97 | 97 | public function yearRange($offset = 0, $time = null) |
| 98 | 98 | { |
| 99 | 99 | null === $time && $time = time(); |
| 100 | - $year = (int) (date('Y', $time) + $offset); |
|
| 100 | + $year = (int)(date('Y', $time) + $offset); |
|
| 101 | 101 | return [ |
| 102 | 102 | mktime(0, 0, 0, 1, 1, $year), |
| 103 | 103 | mktime(23, 59, 59, 12, 31, $year), |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | public function day($offset = 0, $time = null) |
| 116 | 116 | { |
| 117 | 117 | null === $time && $time = time(); |
| 118 | - $offset = (int) $offset; |
|
| 118 | + $offset = (int)$offset; |
|
| 119 | 119 | return $time + 3600 * 24 * $offset; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -130,7 +130,7 @@ discard block |
||
| 130 | 130 | public function week($offset = 0, $time = null) |
| 131 | 131 | { |
| 132 | 132 | null === $time && $time = time(); |
| 133 | - $offset = (int) $offset; |
|
| 133 | + $offset = (int)$offset; |
|
| 134 | 134 | return $time + 3600 * 24 * 7 * $offset; |
| 135 | 135 | } |
| 136 | 136 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | public function month($offset = 0, $time = null) |
| 146 | 146 | { |
| 147 | 147 | null === $time && $time = time(); |
| 148 | - $offset = (int) $offset; |
|
| 148 | + $offset = (int)$offset; |
|
| 149 | 149 | return $time + 3600 * 24 * date('t', $time) * $offset; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | public function year($offset = 0, $time = null) |
| 161 | 161 | { |
| 162 | 162 | null === $time && $time = time(); |
| 163 | - $offset = (int) $offset; |
|
| 164 | - return mktime((int) date('H', $time), (int) date('i', $time), (int) date('s', $time), (int) date('m', $time), (int) date('d', $time), (int) date('Y', $time) + 1); |
|
| 163 | + $offset = (int)$offset; |
|
| 164 | + return mktime((int)date('H', $time), (int)date('i', $time), (int)date('s', $time), (int)date('m', $time), (int)date('d', $time), (int)date('Y', $time) + 1); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | /** |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | public function isLeapYear($time = null) |
| 201 | 201 | { |
| 202 | 202 | null === $time && $time = time(); |
| 203 | - return (bool) date('L', $time); |
|
| 203 | + return (bool)date('L', $time); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | /** |
@@ -215,6 +215,6 @@ discard block |
||
| 215 | 215 | public function yearPosition($time = null) |
| 216 | 216 | { |
| 217 | 217 | null === $time && $time = time(); |
| 218 | - return (int) date('z', $time) + 1; |
|
| 218 | + return (int)date('z', $time) + 1; |
|
| 219 | 219 | } |
| 220 | 220 | } |
@@ -55,7 +55,7 @@ discard block |
||
| 55 | 55 | { |
| 56 | 56 | setlocale(LC_ALL, $locale); |
| 57 | 57 | clearstatcache(); |
| 58 | - $this->_functions['loader'] = function ($fileName, $mode = 'rb') { |
|
| 58 | + $this->_functions['loader'] = function($fileName, $mode = 'rb') { |
|
| 59 | 59 | $hashName = $this->__hash($fileName); |
| 60 | 60 | $this->_attributes[$hashName] = I::get($this->_attributes, $hashName, [ |
| 61 | 61 | 'isCached' => false, |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | } |
| 103 | 103 | } |
| 104 | 104 | curl_close($curl); |
| 105 | - } elseif ((bool) ini_get('allow_url_fopen')) { |
|
| 106 | - $headArray = (array) get_headers($fileName, 1); |
|
| 105 | + } elseif ((bool)ini_get('allow_url_fopen')) { |
|
| 106 | + $headArray = (array)get_headers($fileName, 1); |
|
| 107 | 107 | if (preg_match('/200/', $headArray[0])) { |
| 108 | 108 | $this->_attributes[$hashName]['isExists'] = true; |
| 109 | 109 | $this->_attributes[$hashName]['fileSize'] = $headArray['Content-Length']; |
@@ -111,8 +111,8 @@ discard block |
||
| 111 | 111 | } else { |
| 112 | 112 | $url = parse_url($fileName); |
| 113 | 113 | $host = $url['host']; |
| 114 | - $path = (string) I::get($url, 'path', '/'); |
|
| 115 | - $port = (int) I::get($url, 'port', 80); |
|
| 114 | + $path = (string)I::get($url, 'path', '/'); |
|
| 115 | + $port = (int)I::get($url, 'port', 80); |
|
| 116 | 116 | $fp = fsockopen($host, $port); |
| 117 | 117 | if (is_resource($fp)) { |
| 118 | 118 | $header = [ |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | */ |
| 165 | 165 | private function __file($file) |
| 166 | 166 | { |
| 167 | - return (string) I::getAlias($file); |
|
| 167 | + return (string)I::getAlias($file); |
|
| 168 | 168 | } |
| 169 | 169 | |
| 170 | 170 | /** |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | */ |
| 355 | 355 | public function getFilesize($fileName) |
| 356 | 356 | { |
| 357 | - return (int) $this->attribute($fileName, 'fileSize'); |
|
| 357 | + return (int)$this->attribute($fileName, 'fileSize'); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | /** |
@@ -386,7 +386,7 @@ discard block |
||
| 386 | 386 | */ |
| 387 | 387 | public function isFile($file) |
| 388 | 388 | { |
| 389 | - return (bool) $this->attribute($file, 'isExists'); |
|
| 389 | + return (bool)$this->attribute($file, 'isExists'); |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | /** |
@@ -676,7 +676,7 @@ discard block |
||
| 676 | 676 | @chmod($subFile, $mode); |
| 677 | 677 | } |
| 678 | 678 | } |
| 679 | - return (bool) @chmod($file, $mode); |
|
| 679 | + return (bool)@chmod($file, $mode); |
|
| 680 | 680 | } |
| 681 | 681 | |
| 682 | 682 | /** |