| @@ -277,7 +277,7 @@ discard block | ||
| 277 | 277 | $tables[$row['database']][$row['table']][$node] = $row; | 
| 278 | 278 | } | 
| 279 | 279 | $result['replicas'][$node] = $r; | 
| 280 | -            }catch (\Exception $E) { | |
| 280 | +            } catch (\Exception $E) { | |
| 281 | 281 | $result['replicas'][$node] = false; | 
| 282 | 282 | $badNodes[$node] = $E->getMessage(); | 
| 283 | 283 | $this->error[] = 'statementsReplicas:' . $E->getMessage(); | 
| @@ -299,7 +299,7 @@ discard block | ||
| 299 | 299 | ]; | 
| 300 | 300 | } | 
| 301 | 301 | |
| 302 | -            }catch (\Exception $E) { | |
| 302 | +            } catch (\Exception $E) { | |
| 303 | 303 | $result['clusters'][$node] = false; | 
| 304 | 304 | |
| 305 | 305 | $this->error[] = 'clusters:' . $E->getMessage(); | 
| @@ -9,7 +9,7 @@ | ||
| 9 | 9 | class StreamWrite extends Stream | 
| 10 | 10 |  { | 
| 11 | 11 | |
| 12 | - public function __construct( $source) | |
| 12 | + public function __construct($source) | |
| 13 | 13 |      { | 
| 14 | 14 | |
| 15 | 15 | parent::__construct($source); | 
| @@ -31,7 +31,7 @@ | ||
| 31 | 31 | * @param CurlerRequest $request | 
| 32 | 32 | * @param CurlerRolling|null $curlerRolling | 
| 33 | 33 | */ | 
| 34 | - public function __construct($source, CurlerRequest $request, $curlerRolling=null) | |
| 34 | + public function __construct($source, CurlerRequest $request, $curlerRolling = null) | |
| 35 | 35 |      { | 
| 36 | 36 |          if (!is_resource($source)) { | 
| 37 | 37 |              throw new \InvalidArgumentException('Argument $source must be resource'); | 
| @@ -293,7 +293,7 @@ | ||
| 293 | 293 | |
| 294 | 294 | if (stripos($format, 'json') !== false) | 
| 295 | 295 |          { | 
| 296 | - if (stripos($format,'JSONEachRow')===false) | |
| 296 | + if (stripos($format, 'JSONEachRow') === false) | |
| 297 | 297 | return $this->json(); | 
| 298 | 298 | } | 
| 299 | 299 | return $this->body(); | 
| @@ -293,8 +293,9 @@ | ||
| 293 | 293 | |
| 294 | 294 | if (stripos($format, 'json') !== false) | 
| 295 | 295 |          { | 
| 296 | - if (stripos($format,'JSONEachRow')===false) | |
| 297 | - return $this->json(); | |
| 296 | +            if (stripos($format,'JSONEachRow')===false) { | |
| 297 | + return $this->json(); | |
| 298 | + } | |
| 298 | 299 | } | 
| 299 | 300 | return $this->body(); | 
| 300 | 301 | |
| @@ -15,11 +15,11 @@ discard block | ||
| 15 | 15 | /** | 
| 16 | 16 | * @var bool | 
| 17 | 17 | */ | 
| 18 | - private $gzip=false; | |
| 18 | + private $gzip = false; | |
| 19 | 19 | /** | 
| 20 | 20 | * @var null|callable | 
| 21 | 21 | */ | 
| 22 | - private $callable=null; | |
| 22 | + private $callable = null; | |
| 23 | 23 | /** | 
| 24 | 24 | * @param resource $source | 
| 25 | 25 | */ | 
| @@ -60,7 +60,7 @@ discard block | ||
| 60 | 60 | */ | 
| 61 | 61 | public function closure(callable $callable) | 
| 62 | 62 |      { | 
| 63 | - $this->callable=$callable; | |
| 63 | + $this->callable = $callable; | |
| 64 | 64 | } | 
| 65 | 65 | |
| 66 | 66 | /** | 
| @@ -68,7 +68,7 @@ discard block | ||
| 68 | 68 | */ | 
| 69 | 69 | public function enableGzipHeader() | 
| 70 | 70 |      { | 
| 71 | - $this->gzip=true; | |
| 71 | + $this->gzip = true; | |
| 72 | 72 | } | 
| 73 | 73 | |
| 74 | 74 | } | 
| @@ -56,10 +56,10 @@ discard block | ||
| 56 | 56 | * @param string $pattern | 
| 57 | 57 | * @return string | 
| 58 | 58 | */ | 
| 59 | - public function compile_binds($sql, $binds,$pattern) | |
| 59 | + public function compile_binds($sql, $binds, $pattern) | |
| 60 | 60 |      { | 
| 61 | 61 |          return preg_replace_callback($pattern, function($m) use ($binds){ | 
| 62 | -            if(isset($binds[$m[1]])){ // If it exists in our array | |
| 62 | +            if (isset($binds[$m[1]])) { // If it exists in our array | |
| 63 | 63 | return $binds[$m[1]]; // Then replace it from our array | 
| 64 | 64 | } | 
| 65 | 65 | |
| @@ -75,14 +75,14 @@ discard block | ||
| 75 | 75 | */ | 
| 76 | 76 | public function process($sql) | 
| 77 | 77 |      { | 
| 78 | - $bindFormatted=[]; | |
| 79 | - $bindRaw=[]; | |
| 78 | + $bindFormatted = []; | |
| 79 | + $bindRaw = []; | |
| 80 | 80 |          foreach ($this->bindings as $key => $value) { | 
| 81 | 81 |              if (is_array($value)) { | 
| 82 | 82 |                  $valueSet = implode(', ', $value); | 
| 83 | 83 | |
| 84 | 84 | $values = array_map( | 
| 85 | -                    function ($value) { | |
| 85 | +                    function($value) { | |
| 86 | 86 | return ValueFormatter::formatValue($value); | 
| 87 | 87 | }, | 
| 88 | 88 | $value | 
| @@ -95,21 +95,21 @@ discard block | ||
| 95 | 95 | } | 
| 96 | 96 | |
| 97 | 97 |              if ($formattedParameter !== null) { | 
| 98 | - $bindFormatted[$key]=$formattedParameter; | |
| 98 | + $bindFormatted[$key] = $formattedParameter; | |
| 99 | 99 | } | 
| 100 | 100 | |
| 101 | 101 |              if ($valueSet !== null) { | 
| 102 | - $bindRaw[$key]=$valueSet; | |
| 102 | + $bindRaw[$key] = $valueSet; | |
| 103 | 103 | } | 
| 104 | 104 | } | 
| 105 | 105 | |
| 106 | - for ($loop=0;$loop<2;$loop++) | |
| 106 | + for ($loop = 0; $loop < 2; $loop++) | |
| 107 | 107 |          { | 
| 108 | 108 | // dipping in binds | 
| 109 | 109 |              // example ['A' => '{B}' , 'B'=>':C','C'=>123] | 
| 110 | -            $sql=$this->compile_binds($sql,$bindRaw,'#{([\w+]+)}#'); | |
| 110 | +            $sql = $this->compile_binds($sql, $bindRaw, '#{([\w+]+)}#'); | |
| 111 | 111 | } | 
| 112 | - $sql=$this->compile_binds($sql,$bindFormatted,'#:([\w+]+)#'); | |
| 112 | + $sql = $this->compile_binds($sql, $bindFormatted, '#:([\w+]+)#'); | |
| 113 | 113 | |
| 114 | 114 | return $sql; | 
| 115 | 115 | } | 
| @@ -75,7 +75,7 @@ | ||
| 75 | 75 | $markers = $this->bindings; | 
| 76 | 76 | |
| 77 | 77 | // ------ if/else conditions & if[set|int]/else conditions ----- | 
| 78 | -        $sql = preg_replace_callback('#\{if(.{0,}?)\s+([^\}]+?)\}(.+?)(\{else\}([^\{]+?)?)?\s*\{\/if}#sui', function ($matches) use ($markers) { | |
| 78 | +        $sql = preg_replace_callback('#\{if(.{0,}?)\s+([^\}]+?)\}(.+?)(\{else\}([^\{]+?)?)?\s*\{\/if}#sui', function($matches) use ($markers) { | |
| 79 | 79 | return self::__ifsets($matches, $markers); | 
| 80 | 80 | } | 
| 81 | 81 | , $sql); | 
| @@ -685,8 +685,9 @@ | ||
| 685 | 685 | } | 
| 686 | 686 | return $response; | 
| 687 | 687 |          } finally { | 
| 688 | - if ($streamRW->isWrite()) | |
| 689 | - fclose($stream); | |
| 688 | +            if ($streamRW->isWrite()) { | |
| 689 | + fclose($stream); | |
| 690 | + } | |
| 690 | 691 | } | 
| 691 | 692 | |
| 692 | 693 | |
| @@ -266,7 +266,7 @@ discard block | ||
| 266 | 266 | } | 
| 267 | 267 | |
| 268 | 268 | $new->timeOut($this->settings()->getTimeOut()); | 
| 269 | - $new->connectTimeOut($this->_connectTimeOut);//->keepAlive(); // one sec | |
| 269 | + $new->connectTimeOut($this->_connectTimeOut); //->keepAlive(); // one sec | |
| 270 | 270 | $new->verbose(boolval($this->_verbose)); | 
| 271 | 271 | |
| 272 | 272 | return $new; | 
| @@ -318,7 +318,7 @@ discard block | ||
| 318 | 318 | public function setStdErrOut($stream) | 
| 319 | 319 |      { | 
| 320 | 320 |          if (is_resource($stream)) { | 
| 321 | - $this->stdErrOut=$stream; | |
| 321 | + $this->stdErrOut = $stream; | |
| 322 | 322 | } | 
| 323 | 323 | |
| 324 | 324 | } | 
| @@ -387,7 +387,7 @@ discard block | ||
| 387 | 387 | |
| 388 | 388 | $request->url($url); | 
| 389 | 389 | |
| 390 | -        $request->setCallbackFunction(function (CurlerRequest $request) { | |
| 390 | +        $request->setCallbackFunction(function(CurlerRequest $request) { | |
| 391 | 391 | $handle = $request->getInfileHandle(); | 
| 392 | 392 |              if (is_resource($handle)) { | 
| 393 | 393 | fclose($handle); | 
| @@ -526,7 +526,7 @@ discard block | ||
| 526 | 526 | } | 
| 527 | 527 | |
| 528 | 528 | |
| 529 | -                $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function (CurlerRequest $request) { | |
| 529 | +                $request->setResultFileHandle($fout, $isGz)->setCallbackFunction(function(CurlerRequest $request) { | |
| 530 | 530 | fclose($request->getResultFileHandle()); | 
| 531 | 531 | }); | 
| 532 | 532 | } | 
| @@ -717,11 +717,11 @@ discard block | ||
| 717 | 717 |              if (!is_callable($callable)) { | 
| 718 | 718 |                  if ($streamRW->isWrite()) { | 
| 719 | 719 | |
| 720 | -                    $callable = function ($ch, $fd, $length) use ($stream) { | |
| 720 | +                    $callable = function($ch, $fd, $length) use ($stream) { | |
| 721 | 721 | return ($line = fread($stream, $length)) ? $line : ''; | 
| 722 | 722 | }; | 
| 723 | 723 |                  } else { | 
| 724 | -                    $callable = function ($ch, $fd) use ($stream) { | |
| 724 | +                    $callable = function($ch, $fd) use ($stream) { | |
| 725 | 725 | return fwrite($stream, $fd); | 
| 726 | 726 | }; | 
| 727 | 727 | } | 
| @@ -32,9 +32,9 @@ | ||
| 32 | 32 | * @param bool $skipEncode | 
| 33 | 33 | * @return string | 
| 34 | 34 | */ | 
| 35 | - public static function Insert(array $row,bool $skipEncode=false) | |
| 35 | + public static function Insert(array $row, bool $skipEncode = false) | |
| 36 | 36 |      { | 
| 37 | -        return self::strictQuote('Insert')->quoteRow($row,$skipEncode); | |
| 37 | +        return self::strictQuote('Insert')->quoteRow($row, $skipEncode); | |
| 38 | 38 | } | 
| 39 | 39 | |
| 40 | 40 | /** |