@@ -64,10 +64,10 @@ discard block |
||
| 64 | 64 | * @param string $pattern |
| 65 | 65 | * @return string |
| 66 | 66 | */ |
| 67 | - public function compile_binds($sql, $binds,$pattern) |
|
| 67 | + public function compile_binds($sql, $binds, $pattern) |
|
| 68 | 68 | { |
| 69 | 69 | return preg_replace_callback($pattern, function($m) use ($binds){ |
| 70 | - if(isset($binds[$m[1]])){ // If it exists in our array |
|
| 70 | + if (isset($binds[$m[1]])) { // If it exists in our array |
|
| 71 | 71 | return $binds[$m[1]]; // Then replace it from our array |
| 72 | 72 | } |
| 73 | 73 | |
@@ -83,14 +83,14 @@ discard block |
||
| 83 | 83 | */ |
| 84 | 84 | public function process($sql) |
| 85 | 85 | { |
| 86 | - $bindFormatted=[]; |
|
| 87 | - $bindRaw=[]; |
|
| 86 | + $bindFormatted = []; |
|
| 87 | + $bindRaw = []; |
|
| 88 | 88 | foreach ($this->bindings as $key => $value) { |
| 89 | 89 | if (is_array($value)) { |
| 90 | 90 | $valueSet = implode(', ', $value); |
| 91 | 91 | |
| 92 | 92 | $values = array_map( |
| 93 | - function ($value) { |
|
| 93 | + function($value) { |
|
| 94 | 94 | return $this->formatParameter($value); |
| 95 | 95 | }, |
| 96 | 96 | $value |
@@ -103,21 +103,21 @@ discard block |
||
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | if ($formattedParameter !== null) { |
| 106 | - $bindFormatted[$key]=$formattedParameter; |
|
| 106 | + $bindFormatted[$key] = $formattedParameter; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | if ($valueSet !== null) { |
| 110 | - $bindRaw[$key]=$valueSet; |
|
| 110 | + $bindRaw[$key] = $valueSet; |
|
| 111 | 111 | } |
| 112 | 112 | } |
| 113 | 113 | |
| 114 | - for ($loop=0;$loop<2;$loop++) |
|
| 114 | + for ($loop = 0; $loop < 2; $loop++) |
|
| 115 | 115 | { |
| 116 | 116 | // dipping in binds |
| 117 | 117 | // example ['A' => '{B}' , 'B'=>':C','C'=>123] |
| 118 | - $sql=$this->compile_binds($sql,$bindRaw,'#{([\w+]+)}#'); |
|
| 118 | + $sql = $this->compile_binds($sql, $bindRaw, '#{([\w+]+)}#'); |
|
| 119 | 119 | } |
| 120 | - $sql=$this->compile_binds($sql,$bindFormatted,'#:([\w+]+)#'); |
|
| 120 | + $sql = $this->compile_binds($sql, $bindFormatted, '#:([\w+]+)#'); |
|
| 121 | 121 | |
| 122 | 122 | return $sql; |
| 123 | 123 | } |
@@ -93,7 +93,7 @@ |
||
| 93 | 93 | // single quotation marks with the same screening rules as above. |
| 94 | 94 | // as in the TabSeparated format, and then the resulting string is output in InsertRow in double quotes. |
| 95 | 95 | $value = array_map( |
| 96 | - function ($v) use ($enclosure_esc, $encode_esc) { |
|
| 96 | + function($v) use ($enclosure_esc, $encode_esc) { |
|
| 97 | 97 | return is_string($v) ? $this->encodeString($v, $enclosure_esc, $encode_esc) : $v; |
| 98 | 98 | }, |
| 99 | 99 | $value |