@@ -6,7 +6,7 @@ discard block |
||
| 6 | 6 | class StrictQuoteLine |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - private $preset=[ |
|
| 9 | + private $preset = [ |
|
| 10 | 10 | 'CSV'=>[ |
| 11 | 11 | 'EnclosureArray'=>'"', |
| 12 | 12 | 'EncodeEnclosure'=>'"', |
@@ -32,19 +32,19 @@ discard block |
||
| 32 | 32 | 'TabEncode'=>true, |
| 33 | 33 | ], |
| 34 | 34 | ]; |
| 35 | - private $settings=[]; |
|
| 35 | + private $settings = []; |
|
| 36 | 36 | |
| 37 | 37 | public function __construct($format) |
| 38 | 38 | { |
| 39 | 39 | if (empty($this->preset[$format])) |
| 40 | 40 | { |
| 41 | - throw new QueryException("Unsupport format encode line:".$format); |
|
| 41 | + throw new QueryException("Unsupport format encode line:" . $format); |
|
| 42 | 42 | } |
| 43 | - $this->settings=$this->preset[$format]; |
|
| 43 | + $this->settings = $this->preset[$format]; |
|
| 44 | 44 | } |
| 45 | 45 | public function quoteRow($row) |
| 46 | 46 | { |
| 47 | - return implode($this->settings['Delimiter'],$this->quoteValue($row)); |
|
| 47 | + return implode($this->settings['Delimiter'], $this->quoteValue($row)); |
|
| 48 | 48 | } |
| 49 | 49 | public function quoteValue($row) |
| 50 | 50 | { |
@@ -53,10 +53,10 @@ discard block |
||
| 53 | 53 | $encode = $this->settings['EncodeEnclosure']; |
| 54 | 54 | $encodeArray = $this->settings['EnclosureArray']; |
| 55 | 55 | $null = $this->settings['Null']; |
| 56 | - $tabEncode=$this->settings['TabEncode']; |
|
| 56 | + $tabEncode = $this->settings['TabEncode']; |
|
| 57 | 57 | |
| 58 | 58 | |
| 59 | - $quote = function ($value) use ($enclosure,$delimiter,$encode,$encodeArray,$null,$tabEncode) { |
|
| 59 | + $quote = function($value) use ($enclosure, $delimiter, $encode, $encodeArray, $null, $tabEncode) { |
|
| 60 | 60 | |
| 61 | 61 | |
| 62 | 62 | |
@@ -75,11 +75,11 @@ discard block |
||
| 75 | 75 | if (is_string($value)) { |
| 76 | 76 | if ($tabEncode) |
| 77 | 77 | { |
| 78 | - return str_replace(["\t","\n"],['\\t','\\n'],$value); |
|
| 78 | + return str_replace(["\t", "\n"], ['\\t', '\\n'], $value); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | $value = strval($value); |
| 82 | - $value = preg_replace('/('.$enclosure_esc.'|'.$encode_esc.')/',$encode_esc.'\1', $value); |
|
| 82 | + $value = preg_replace('/(' . $enclosure_esc . '|' . $encode_esc . ')/', $encode_esc . '\1', $value); |
|
| 83 | 83 | return $enclosure . $value . $enclosure; |
| 84 | 84 | } |
| 85 | 85 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | // as in the TabSeparated format, and then the resulting string is output in InsertRow in double quotes. |
| 91 | 91 | $result_array = FormatLine::Insert($value); |
| 92 | 92 | |
| 93 | - return $encodeArray . '[' . $result_array . ']' .$encodeArray; |
|
| 93 | + return $encodeArray . '[' . $result_array . ']' . $encodeArray; |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | if (null === $value) { |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * |
| 9 | 9 | * @var array |
| 10 | 10 | */ |
| 11 | - private static $strict=[]; |
|
| 11 | + private static $strict = []; |
|
| 12 | 12 | |
| 13 | 13 | /** |
| 14 | 14 | * Format |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | { |
| 21 | 21 | if (empty(self::$strict[$format])) |
| 22 | 22 | { |
| 23 | - self::$strict[$format]=new StrictQuoteLine($format); |
|
| 23 | + self::$strict[$format] = new StrictQuoteLine($format); |
|
| 24 | 24 | } |
| 25 | 25 | return self::$strict[$format]; |
| 26 | 26 | } |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function bindParams(array $bindings) |
| 15 | 15 | { |
| 16 | - $this->bindings=[]; |
|
| 16 | + $this->bindings = []; |
|
| 17 | 17 | foreach ($bindings as $column => $value) { |
| 18 | 18 | $this->bindParam($column, $value); |
| 19 | 19 | } |
@@ -17,44 +17,44 @@ discard block |
||
| 17 | 17 | public function bindParams(array $bindings) |
| 18 | 18 | { |
| 19 | 19 | foreach ($bindings as $column => $value) { |
| 20 | - $this->bindings[$column]=$value; |
|
| 20 | + $this->bindings[$column] = $value; |
|
| 21 | 21 | } |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
| 25 | - static function __ifsets($matches,$markers,$else=false) |
|
| 25 | + static function __ifsets($matches, $markers, $else = false) |
|
| 26 | 26 | { |
| 27 | - $content_false=''; |
|
| 27 | + $content_false = ''; |
|
| 28 | 28 | |
| 29 | 29 | if ($else) |
| 30 | 30 | { |
| 31 | - list($condition, $preset ,$variable, $content_true, $content_false) = $matches; |
|
| 31 | + list($condition, $preset, $variable, $content_true, $content_false) = $matches; |
|
| 32 | 32 | } |
| 33 | 33 | else |
| 34 | 34 | { |
| 35 | - list($condition, $preset ,$variable, $content_true) = $matches; |
|
| 35 | + list($condition, $preset, $variable, $content_true) = $matches; |
|
| 36 | 36 | } |
| 37 | - $preset=strtolower($preset); |
|
| 37 | + $preset = strtolower($preset); |
|
| 38 | 38 | |
| 39 | - if ($preset=='set') |
|
| 39 | + if ($preset == 'set') |
|
| 40 | 40 | { |
| 41 | - return (isset($markers[$variable]) && !empty($markers[$variable])) ? $content_true: $content_false; |
|
| 41 | + return (isset($markers[$variable]) && !empty($markers[$variable])) ? $content_true : $content_false; |
|
| 42 | 42 | } |
| 43 | - if ($preset=='bool') |
|
| 43 | + if ($preset == 'bool') |
|
| 44 | 44 | { |
| 45 | - return (isset($markers[$variable]) && is_bool($markers[$variable]) && $markers[$variable]==true) |
|
| 45 | + return (isset($markers[$variable]) && is_bool($markers[$variable]) && $markers[$variable] == true) |
|
| 46 | 46 | ? $content_true |
| 47 | 47 | : $content_false; |
| 48 | 48 | } |
| 49 | - if ($preset=='string') |
|
| 49 | + if ($preset == 'string') |
|
| 50 | 50 | { |
| 51 | 51 | return (isset($markers[$variable]) && is_string($markers[$variable]) && strlen($markers[$variable])) |
| 52 | 52 | ? $content_true |
| 53 | 53 | : $content_false; |
| 54 | 54 | } |
| 55 | - if ($preset=='int') |
|
| 55 | + if ($preset == 'int') |
|
| 56 | 56 | { |
| 57 | - return (isset($markers[$variable]) && intval($markers[$variable])<>0 ) |
|
| 57 | + return (isset($markers[$variable]) && intval($markers[$variable]) <> 0) |
|
| 58 | 58 | ? $content_true |
| 59 | 59 | : $content_false; |
| 60 | 60 | } |
@@ -68,29 +68,29 @@ discard block |
||
| 68 | 68 | */ |
| 69 | 69 | public function process($sql) |
| 70 | 70 | { |
| 71 | - $markers=$this->bindings; |
|
| 71 | + $markers = $this->bindings; |
|
| 72 | 72 | |
| 73 | 73 | // 2. process if/else conditions |
| 74 | - $sql = preg_replace_callback('#\{if\s(.+?)}(.+?)\{else}(.+?)\{/if}#sui', function ($matches) use ($markers) { |
|
| 74 | + $sql = preg_replace_callback('#\{if\s(.+?)}(.+?)\{else}(.+?)\{/if}#sui', function($matches) use ($markers) { |
|
| 75 | 75 | list($condition, $variable, $content_true, $content_false) = $matches; |
| 76 | 76 | |
| 77 | - return (isset($markers[$variable]) && ( $markers[$variable] || is_numeric($markers[$variable]) ) ) |
|
| 77 | + return (isset($markers[$variable]) && ($markers[$variable] || is_numeric($markers[$variable]))) |
|
| 78 | 78 | ? $content_true |
| 79 | 79 | : $content_false; |
| 80 | 80 | }, $sql); |
| 81 | 81 | |
| 82 | 82 | // 3. process if conditions |
| 83 | - $sql = preg_replace_callback('#\{if\s(.+?)}(.+?)\{/if}#sui', function ($matches) use ($markers) { |
|
| 83 | + $sql = preg_replace_callback('#\{if\s(.+?)}(.+?)\{/if}#sui', function($matches) use ($markers) { |
|
| 84 | 84 | list($condition, $variable, $content) = $matches; |
| 85 | 85 | |
| 86 | - if (isset($markers[$variable]) && ( $markers[$variable] || is_numeric($markers[$variable]) )) { |
|
| 86 | + if (isset($markers[$variable]) && ($markers[$variable] || is_numeric($markers[$variable]))) { |
|
| 87 | 87 | return $content; |
| 88 | 88 | } |
| 89 | 89 | }, $sql); |
| 90 | 90 | |
| 91 | 91 | // 1. process if[set|int]/else conditions |
| 92 | - $sql = preg_replace_callback('#\{if(.{1,}?)\s(.+?)}(.+?)\{else}(.+?)\{/if}#sui', function ($matches) use ($markers) {return self::__ifsets($matches,$markers,true); }, $sql); |
|
| 93 | - $sql = preg_replace_callback('#\{if(.{1,}?)\s(.+?)}(.+?)\{/if}#sui', function ($matches) use ($markers) { return self::__ifsets($matches,$markers,false); }, $sql); |
|
| 92 | + $sql = preg_replace_callback('#\{if(.{1,}?)\s(.+?)}(.+?)\{else}(.+?)\{/if}#sui', function($matches) use ($markers) {return self::__ifsets($matches, $markers, true); }, $sql); |
|
| 93 | + $sql = preg_replace_callback('#\{if(.{1,}?)\s(.+?)}(.+?)\{/if}#sui', function($matches) use ($markers) { return self::__ifsets($matches, $markers, false); }, $sql); |
|
| 94 | 94 | |
| 95 | 95 | return $sql; |
| 96 | 96 | } |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | */ |
| 71 | 71 | public function total_time() |
| 72 | 72 | { |
| 73 | - return round($this->_info['total_time'],3); |
|
| 73 | + return round($this->_info['total_time'], 3); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function starttransfer_time() |
| 80 | 80 | { |
| 81 | - return round($this->_info['starttransfer_time'],3); |
|
| 81 | + return round($this->_info['starttransfer_time'], 3); |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -86,7 +86,7 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function connect_time() |
| 88 | 88 | { |
| 89 | - return round($this->_info['connect_time'],3); |
|
| 89 | + return round($this->_info['connect_time'], 3); |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | /** |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | */ |
| 95 | 95 | public function pretransfer_time() |
| 96 | 96 | { |
| 97 | - return round($this->_info['pretransfer_time'],3); |
|
| 97 | + return round($this->_info['pretransfer_time'], 3); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | /** |
@@ -289,7 +289,7 @@ discard block |
||
| 289 | 289 | */ |
| 290 | 290 | public function rawDataOrJson($format) |
| 291 | 291 | { |
| 292 | - if (stripos($format,'json')!==false) |
|
| 292 | + if (stripos($format, 'json') !== false) |
|
| 293 | 293 | { |
| 294 | 294 | return $this->json(); |
| 295 | 295 | } |
@@ -16,12 +16,12 @@ discard block |
||
| 16 | 16 | */ |
| 17 | 17 | private $settings = []; |
| 18 | 18 | |
| 19 | - private $_ReadOnlyUser=false; |
|
| 19 | + private $_ReadOnlyUser = false; |
|
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * @var bool |
| 23 | 23 | */ |
| 24 | - private $_isHttps=false; |
|
| 24 | + private $_isHttps = false; |
|
| 25 | 25 | |
| 26 | 26 | /** |
| 27 | 27 | * Settings constructor. |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | } |
| 117 | 117 | |
| 118 | 118 | |
| 119 | - public function https($flag=true) |
|
| 119 | + public function https($flag = true) |
|
| 120 | 120 | { |
| 121 | 121 | $this->set('https', $flag); |
| 122 | 122 | return $this; |
@@ -201,7 +201,7 @@ discard block |
||
| 201 | 201 | */ |
| 202 | 202 | public function setReadOnlyUser($flag) |
| 203 | 203 | { |
| 204 | - $this->_ReadOnlyUser=$flag; |
|
| 204 | + $this->_ReadOnlyUser = $flag; |
|
| 205 | 205 | } |
| 206 | 206 | |
| 207 | 207 | /** |
@@ -20,21 +20,21 @@ discard block |
||
| 20 | 20 | /** |
| 21 | 21 | * @var array |
| 22 | 22 | */ |
| 23 | - private $degenerations=[]; |
|
| 23 | + private $degenerations = []; |
|
| 24 | 24 | |
| 25 | 25 | /** |
| 26 | 26 | * Query constructor. |
| 27 | 27 | * @param string $sql |
| 28 | 28 | * @param array $degenerations |
| 29 | 29 | */ |
| 30 | - public function __construct($sql,$degenerations=[]) |
|
| 30 | + public function __construct($sql, $degenerations = []) |
|
| 31 | 31 | { |
| 32 | 32 | if (!trim($sql)) |
| 33 | 33 | { |
| 34 | 34 | throw new QueryException('Empty Query'); |
| 35 | 35 | } |
| 36 | 36 | $this->sql = $sql; |
| 37 | - $this->degenerations=$degenerations; |
|
| 37 | + $this->degenerations = $degenerations; |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
@@ -50,17 +50,17 @@ discard block |
||
| 50 | 50 | { |
| 51 | 51 | // FORMAT\s(\w)*$ |
| 52 | 52 | if (null === $this->format) return false; |
| 53 | - $supportFormats= |
|
| 53 | + $supportFormats = |
|
| 54 | 54 | "FORMAT\\s+TSV|FORMAT\\s+TSVRaw|FORMAT\\s+TSVWithNames|FORMAT\\s+TSVWithNamesAndTypes|FORMAT\\s+Vertical|FORMAT\\s+JSONCompact|FORMAT\\s+JSONEachRow|FORMAT\\s+TSKV|FORMAT\\s+TabSeparatedWithNames|FORMAT\\s+TabSeparatedWithNamesAndTypes|FORMAT\\s+TabSeparatedRaw|FORMAT\\s+BlockTabSeparated|FORMAT\\s+CSVWithNames|FORMAT\\s+CSV|FORMAT\\s+JSON|FORMAT\\s+TabSeparated"; |
| 55 | 55 | |
| 56 | - $matches=[]; |
|
| 57 | - if (preg_match_all('%('.$supportFormats.')%ius',$this->sql,$matches)){ |
|
| 56 | + $matches = []; |
|
| 57 | + if (preg_match_all('%(' . $supportFormats . ')%ius', $this->sql, $matches)) { |
|
| 58 | 58 | |
| 59 | 59 | // skip add "format json" |
| 60 | 60 | if (isset($matches[0])) |
| 61 | 61 | { |
| 62 | 62 | |
| 63 | - $this->format=trim(str_ireplace('format','',$matches[0][0])); |
|
| 63 | + $this->format = trim(str_ireplace('format', '', $matches[0][0])); |
|
| 64 | 64 | |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -95,7 +95,7 @@ discard block |
||
| 95 | 95 | foreach ($this->degenerations as $degeneration) |
| 96 | 96 | { |
| 97 | 97 | if ($degeneration instanceof Degeneration) { |
| 98 | - $this->sql=$degeneration->process($this->sql); |
|
| 98 | + $this->sql = $degeneration->process($this->sql); |
|
| 99 | 99 | } |
| 100 | 100 | } |
| 101 | 101 | } |
@@ -13,7 +13,7 @@ discard block |
||
| 13 | 13 | const FORMAT_TabSeparatedWithNames = 'TabSeparatedWithNames'; |
| 14 | 14 | const FORMAT_CSV = 'CSV'; |
| 15 | 15 | |
| 16 | - private $support_format=['TabSeparated','TabSeparatedWithNames','CSV']; |
|
| 16 | + private $support_format = ['TabSeparated', 'TabSeparatedWithNames', 'CSV']; |
|
| 17 | 17 | /** |
| 18 | 18 | * @var string |
| 19 | 19 | */ |
@@ -22,19 +22,19 @@ discard block |
||
| 22 | 22 | /** |
| 23 | 23 | * @var string |
| 24 | 24 | */ |
| 25 | - private $format='CSV'; |
|
| 25 | + private $format = 'CSV'; |
|
| 26 | 26 | |
| 27 | 27 | /** |
| 28 | 28 | * @var bool |
| 29 | 29 | */ |
| 30 | - private $gzip=false; |
|
| 30 | + private $gzip = false; |
|
| 31 | 31 | /** |
| 32 | 32 | * WriteToFile constructor. |
| 33 | 33 | * @param string $file_name |
| 34 | 34 | * @param bool $overwrite |
| 35 | 35 | * @param null $format |
| 36 | 36 | */ |
| 37 | - public function __construct($file_name,$overwrite=true,$format=null) { |
|
| 37 | + public function __construct($file_name, $overwrite = true, $format = null) { |
|
| 38 | 38 | |
| 39 | 39 | |
| 40 | 40 | if (!$file_name) |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | throw new QueryException('Can`t delete: ' . $file_name); |
| 54 | 54 | } |
| 55 | 55 | } |
| 56 | - $dir=dirname($file_name); |
|
| 56 | + $dir = dirname($file_name); |
|
| 57 | 57 | if (!is_writable($dir)) |
| 58 | 58 | { |
| 59 | 59 | throw new QueryException('Can`t writable dir: ' . $dir); |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | { |
| 63 | 63 | $this->setFormat($format); |
| 64 | 64 | } |
| 65 | - $this->file_name=$file_name; |
|
| 65 | + $this->file_name = $file_name; |
|
| 66 | 66 | } |
| 67 | 67 | |
| 68 | 68 | /** |
@@ -78,7 +78,7 @@ discard block |
||
| 78 | 78 | */ |
| 79 | 79 | public function setGzip($flag) |
| 80 | 80 | { |
| 81 | - $this->gzip=$flag; |
|
| 81 | + $this->gzip = $flag; |
|
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | /** |
@@ -86,11 +86,11 @@ discard block |
||
| 86 | 86 | */ |
| 87 | 87 | public function setFormat($format) |
| 88 | 88 | { |
| 89 | - if (!in_array($format,$this->support_format)) |
|
| 89 | + if (!in_array($format, $this->support_format)) |
|
| 90 | 90 | { |
| 91 | 91 | throw new QueryException('Unsupport format: ' . $format); |
| 92 | 92 | } |
| 93 | - $this->format=$format; |
|
| 93 | + $this->format = $format; |
|
| 94 | 94 | } |
| 95 | 95 | /** |
| 96 | 96 | * @return int |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | /** |
| 62 | 62 | * @var callable |
| 63 | 63 | */ |
| 64 | - private $xClickHouseProgress=null; |
|
| 64 | + private $xClickHouseProgress = null; |
|
| 65 | 65 | |
| 66 | 66 | /** |
| 67 | 67 | * Http constructor. |
@@ -113,10 +113,10 @@ discard block |
||
| 113 | 113 | */ |
| 114 | 114 | public function getUri() |
| 115 | 115 | { |
| 116 | - $proto='http'; |
|
| 117 | - if ($this->settings()->isHttps()) $proto='https'; |
|
| 116 | + $proto = 'http'; |
|
| 117 | + if ($this->settings()->isHttps()) $proto = 'https'; |
|
| 118 | 118 | |
| 119 | - return $proto.'://' . $this->_host . ':' . $this->_port; |
|
| 119 | + return $proto . '://' . $this->_host . ':' . $this->_port; |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | /** |
@@ -185,7 +185,7 @@ discard block |
||
| 185 | 185 | } |
| 186 | 186 | |
| 187 | 187 | $new->timeOut($this->settings()->getTimeOut()); |
| 188 | - $new->connectTimeOut($this->_connectTimeOut)->keepAlive();// one sec |
|
| 188 | + $new->connectTimeOut($this->_connectTimeOut)->keepAlive(); // one sec |
|
| 189 | 189 | $new->verbose(boolval($this->_verbose)); |
| 190 | 190 | |
| 191 | 191 | return $new; |
@@ -279,7 +279,7 @@ discard block |
||
| 279 | 279 | $request = $this->newRequest($extendinfo); |
| 280 | 280 | $request->url($url); |
| 281 | 281 | |
| 282 | - $request->setCallbackFunction(function (CurlerRequest $request) { |
|
| 282 | + $request->setCallbackFunction(function(CurlerRequest $request) { |
|
| 283 | 283 | fclose($request->getInfileHandle()); |
| 284 | 284 | }); |
| 285 | 285 | |
@@ -322,29 +322,29 @@ discard block |
||
| 322 | 322 | |
| 323 | 323 | public function __findXClickHouseProgress($handle) |
| 324 | 324 | { |
| 325 | - $code=curl_getinfo($handle,CURLINFO_HTTP_CODE); |
|
| 325 | + $code = curl_getinfo($handle, CURLINFO_HTTP_CODE); |
|
| 326 | 326 | |
| 327 | 327 | // Search X-ClickHouse-Progress |
| 328 | - if ($code==200) { |
|
| 328 | + if ($code == 200) { |
|
| 329 | 329 | $response = curl_multi_getcontent($handle); |
| 330 | 330 | $header_size = curl_getinfo($handle, CURLINFO_HEADER_SIZE); |
| 331 | 331 | if (!$header_size) return false; |
| 332 | 332 | |
| 333 | 333 | $header = substr($response, 0, $header_size); |
| 334 | 334 | if (!$header_size) return false; |
| 335 | - $pos=strrpos($header,'X-ClickHouse-Progress'); |
|
| 335 | + $pos = strrpos($header, 'X-ClickHouse-Progress'); |
|
| 336 | 336 | |
| 337 | 337 | if (!$pos) return false; |
| 338 | 338 | |
| 339 | - $last=substr($header,$pos); |
|
| 340 | - $data=@json_decode(str_ireplace('X-ClickHouse-Progress:','',$last),true); |
|
| 339 | + $last = substr($header, $pos); |
|
| 340 | + $data = @json_decode(str_ireplace('X-ClickHouse-Progress:', '', $last), true); |
|
| 341 | 341 | |
| 342 | 342 | if ($data && is_callable($this->xClickHouseProgress)) { |
| 343 | 343 | |
| 344 | - if (is_array($this->xClickHouseProgress)){ |
|
| 345 | - call_user_func_array($this->xClickHouseProgress,[$data]); |
|
| 344 | + if (is_array($this->xClickHouseProgress)) { |
|
| 345 | + call_user_func_array($this->xClickHouseProgress, [$data]); |
|
| 346 | 346 | } else { |
| 347 | - call_user_func($this->xClickHouseProgress,$data); |
|
| 347 | + call_user_func($this->xClickHouseProgress, $data); |
|
| 348 | 348 | } |
| 349 | 349 | |
| 350 | 350 | |
@@ -407,13 +407,13 @@ discard block |
||
| 407 | 407 | } |
| 408 | 408 | |
| 409 | 409 | |
| 410 | - $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function (CurlerRequest $request) { |
|
| 410 | + $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function(CurlerRequest $request) { |
|
| 411 | 411 | fclose($request->getResultFileHandle()); |
| 412 | 412 | }); |
| 413 | 413 | } |
| 414 | 414 | if ($this->xClickHouseProgress) |
| 415 | 415 | { |
| 416 | - $request->setFunctionProgress([$this,'__findXClickHouseProgress']); |
|
| 416 | + $request->setFunctionProgress([$this, '__findXClickHouseProgress']); |
|
| 417 | 417 | } |
| 418 | 418 | // --------------------------------------------------------------------------------- |
| 419 | 419 | return $request; |
@@ -543,7 +543,7 @@ discard block |
||
| 543 | 543 | */ |
| 544 | 544 | public function setProgressFunction(callable $callback) |
| 545 | 545 | { |
| 546 | - $this->xClickHouseProgress=$callback; |
|
| 546 | + $this->xClickHouseProgress = $callback; |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | /** |