Passed
Push — master ( a9ffac...1c0a00 )
by Igor
02:23
created
src/Query/Degeneration/Bindings.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -87,12 +87,12 @@  discard block
 block discarded – undo
87 87
      * @param string $pattern
88 88
      * @return string
89 89
      */
90
-    public function compile_binds($sql, $binds,$pattern)
90
+    public function compile_binds($sql, $binds, $pattern)
91 91
     {
92 92
         return preg_replace_callback($pattern, function($m) use ($binds){
93
-            if(isset($binds[$m[1]])){ // If it exists in our array
93
+            if (isset($binds[$m[1]])) { // If it exists in our array
94 94
                 return $binds[$m[1]]; // Then replace it from our array
95
-            }else{
95
+            } else {
96 96
                 return $m[0]; // Otherwise return the whole match (basically we won't change it)
97 97
             }
98 98
         }, $sql);
@@ -109,8 +109,8 @@  discard block
 block discarded – undo
109 109
     {
110 110
         arsort($this->bindings);
111 111
 
112
-        $bindFormatted=[];
113
-        $bindRaw=[];
112
+        $bindFormatted = [];
113
+        $bindRaw = [];
114 114
         foreach ($this->bindings as $key => $value) {
115 115
             $valueSet           = null;
116 116
             $formattedParameter = null;
@@ -123,7 +123,7 @@  discard block
 block discarded – undo
123 123
                 $escapedValues = $this->escapeArray($value);
124 124
 
125 125
                 $escapedValues = array_map(
126
-                    function ($escapedValue) {
126
+                    function($escapedValue) {
127 127
                         if (is_string($escapedValue)) {
128 128
                             return $this->formatStringParameter($escapedValue);
129 129
                         }
@@ -148,21 +148,21 @@  discard block
 block discarded – undo
148 148
             }
149 149
 
150 150
             if ($formattedParameter !== null) {
151
-                $bindFormatted[$key]=$formattedParameter;
151
+                $bindFormatted[$key] = $formattedParameter;
152 152
             }
153 153
 
154 154
             if ($valueSet !== null) {
155
-                $bindRaw[$key]=$valueSet;
155
+                $bindRaw[$key] = $valueSet;
156 156
             }
157 157
         }
158 158
 
159
-        for ($loop=0;$loop<2;$loop++)
159
+        for ($loop = 0; $loop < 2; $loop++)
160 160
         {
161 161
             // dipping in binds
162 162
             // example ['A' => '{B}' , 'B'=>':C','C'=>123]
163
-            $sql=$this->compile_binds($sql,$bindRaw,'#{([\w+]+)}#');
163
+            $sql = $this->compile_binds($sql, $bindRaw, '#{([\w+]+)}#');
164 164
         }
165
-        $sql=$this->compile_binds($sql,$bindFormatted,'#:([\w+]+)#');
165
+        $sql = $this->compile_binds($sql, $bindFormatted, '#:([\w+]+)#');
166 166
 
167 167
         return $sql;
168 168
     }
Please login to merge, or discard this patch.