Passed
Pull Request — master (#94)
by Šimon
04:26
created
src/Client.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -59,19 +59,19 @@  discard block
 block discarded – undo
59 59
      */
60 60
     public function __construct(array $connectParams, array $settings = [])
61 61
     {
62
-        if (! isset($connectParams['username'])) {
62
+        if (!isset($connectParams['username'])) {
63 63
             throw  new \InvalidArgumentException('not set username');
64 64
         }
65 65
 
66
-        if (! isset($connectParams['password'])) {
66
+        if (!isset($connectParams['password'])) {
67 67
             throw  new \InvalidArgumentException('not set password');
68 68
         }
69 69
 
70
-        if (! isset($connectParams['port'])) {
70
+        if (!isset($connectParams['port'])) {
71 71
             throw  new \InvalidArgumentException('not set port');
72 72
         }
73 73
 
74
-        if (! isset($connectParams['host'])) {
74
+        if (!isset($connectParams['host'])) {
75 75
             throw  new \InvalidArgumentException('not set host');
76 76
         }
77 77
 
@@ -92,7 +92,7 @@  discard block
 block discarded – undo
92 92
 
93 93
         // apply settings to transport class
94 94
         $this->settings()->database('default');
95
-        if (! empty($settings)) {
95
+        if (!empty($settings)) {
96 96
             $this->settings()->apply($settings);
97 97
         }
98 98
 
@@ -198,7 +198,7 @@  discard block
 block discarded – undo
198 198
      */
199 199
     public function transport()
200 200
     {
201
-        if (! $this->transport) {
201
+        if (!$this->transport) {
202 202
             throw  new \InvalidArgumentException('Empty transport class');
203 203
         }
204 204
 
@@ -266,8 +266,8 @@  discard block
 block discarded – undo
266 266
      */
267 267
     public function useSession(bool $useSessionId = false)
268 268
     {
269
-        if (! $this->settings()->getSessionId()) {
270
-            if (! $useSessionId) {
269
+        if (!$this->settings()->getSessionId()) {
270
+            if (!$useSessionId) {
271 271
                 $this->settings()->makeSessionId();
272 272
             } else {
273 273
                 $this->settings()->session_id($useSessionId);
@@ -381,14 +381,14 @@  discard block
 block discarded – undo
381 381
      */
382 382
     public function progressFunction(callable $callback)
383 383
     {
384
-        if (! is_callable($callback)) {
384
+        if (!is_callable($callback)) {
385 385
             throw new \InvalidArgumentException('Not is_callable progressFunction');
386 386
         }
387 387
 
388
-        if (! $this->settings()->is('send_progress_in_http_headers')) {
388
+        if (!$this->settings()->is('send_progress_in_http_headers')) {
389 389
             $this->settings()->set('send_progress_in_http_headers', 1);
390 390
         }
391
-        if (! $this->settings()->is('http_headers_progress_interval_ms')) {
391
+        if (!$this->settings()->is('http_headers_progress_interval_ms')) {
392 392
             $this->settings()->set('http_headers_progress_interval_ms', 100);
393 393
         }
394 394
 
@@ -567,14 +567,14 @@  discard block
 block discarded – undo
567 567
             throw new QueryException('Queue must be empty, before insertBatch, need executeAsync');
568 568
         }
569 569
 
570
-        if (! in_array($format, self::SUPPORTED_FORMATS, true)) {
570
+        if (!in_array($format, self::SUPPORTED_FORMATS, true)) {
571 571
             throw new QueryException('Format not support in insertBatchFiles');
572 572
         }
573 573
 
574 574
         $result = [];
575 575
 
576 576
         foreach ($fileNames as $fileName) {
577
-            if (! is_file($fileName) || ! is_readable($fileName)) {
577
+            if (!is_file($fileName) || !is_readable($fileName)) {
578 578
                 throw  new QueryException('Cant read file: ' . $fileName . ' ' . (is_file($fileName) ? '' : ' is not file'));
579 579
             }
580 580
 
@@ -591,7 +591,7 @@  discard block
 block discarded – undo
591 591
 
592 592
         // fetch resutl
593 593
         foreach ($fileNames as $fileName) {
594
-            if (! $result[$fileName]->isError()) {
594
+            if (!$result[$fileName]->isError()) {
595 595
                 continue;
596 596
             }
597 597
 
@@ -614,7 +614,7 @@  discard block
 block discarded – undo
614 614
             throw new QueryException('Queue must be empty, before insertBatch, need executeAsync');
615 615
         }
616 616
 
617
-        if (! in_array($format, self::SUPPORTED_FORMATS, true)) {
617
+        if (!in_array($format, self::SUPPORTED_FORMATS, true)) {
618 618
             throw new QueryException('Format not support in insertBatchFiles');
619 619
         }
620 620
 
Please login to merge, or discard this patch.
src/Query/Degeneration/Bindings.php 1 patch
Spacing   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -56,10 +56,10 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.