@@ -106,36 +106,36 @@ public function fetchAll(string $sql, array $params = []): array
106106 protected function processInStatementSql (string $ sql , array $ params = []): array
107107 {
108108 // Replace "IN(?)" with "IN(?,?,?)"
109- $ sql = preg_replace ('/IN\s*\(\s*\?\s*\)/i ' , 'IN(?) ' , $ sql );
109+ $ sql = preg_replace ('/IN\s*\(\s*\?\s*\)/i ' , 'IN(?) ' , $ sql );
110110
111- $ current_index = 0 ;
112- while (($ current_index = strpos ($ sql , 'IN(?) ' , $ current_index )) !== false ) {
113- $ preceeding_count = substr_count ($ sql , '? ' , 0 , $ current_index - 1 );
111+ $ current_index = 0 ;
112+ while (($ current_index = strpos ($ sql , 'IN(?) ' , $ current_index )) !== false ) {
113+ $ preceeding_count = substr_count ($ sql , '? ' , 0 , $ current_index - 1 );
114114
115- $ param = $ params [$ preceeding_count ];
116- $ question_marks = '? ' ;
115+ $ param = $ params [$ preceeding_count ];
116+ $ question_marks = '? ' ;
117117
118- if (is_string ($ param ) || is_array ($ param )) {
119- $ params_to_use = $ param ;
120- if (is_string ($ param )) {
121- $ params_to_use = explode (', ' , $ param );
122- }
118+ if (is_string ($ param ) || is_array ($ param )) {
119+ $ params_to_use = $ param ;
120+ if (is_string ($ param )) {
121+ $ params_to_use = explode (', ' , $ param );
122+ }
123123
124- foreach ($ params_to_use as $ key => $ value ) {
125- if (is_string ($ value )) {
126- $ params_to_use [$ key ] = trim ($ value );
124+ foreach ($ params_to_use as $ key => $ value ) {
125+ if (is_string ($ value )) {
126+ $ params_to_use [$ key ] = trim ($ value );
127+ }
127128 }
128- }
129129
130- $ question_marks = join (', ' , array_fill (0 , count ($ params_to_use ), '? ' ));
131- $ sql = substr_replace ($ sql , $ question_marks , $ current_index + 3 , 1 );
130+ $ question_marks = join (', ' , array_fill (0 , count ($ params_to_use ), '? ' ));
131+ $ sql = substr_replace ($ sql , $ question_marks , $ current_index + 3 , 1 );
132132
133- array_splice ($ params , $ preceeding_count , 1 , $ params_to_use );
134- }
133+ array_splice ($ params , $ preceeding_count , 1 , $ params_to_use );
134+ }
135135
136- $ current_index += strlen ($ question_marks ) + 4 ;
137- }
136+ $ current_index += strlen ($ question_marks ) + 4 ;
137+ }
138138
139- return [ 'sql ' => $ sql , 'params ' => $ params ];
139+ return [ 'sql ' => $ sql , 'params ' => $ params ];
140140 }
141141}
0 commit comments