@@ -87,12 +87,12 @@ discard block |
||
| 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 |
||
| 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 |
||
| 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,20 +148,20 @@ discard block |
||
| 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}'] |
| 163 | - $sql=$this->compile_binds($sql,$bindFormatted,'#:([\w+]+)#'); |
|
| 164 | - $sql=$this->compile_binds($sql,$bindRaw,'#{([\w+]+)}#'); |
|
| 163 | + $sql = $this->compile_binds($sql, $bindFormatted, '#:([\w+]+)#'); |
|
| 164 | + $sql = $this->compile_binds($sql, $bindRaw, '#{([\w+]+)}#'); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | return $sql; |