@@ -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 | } |