@@ -97,7 +97,6 @@ public function process(array $params, bool $useParams = false): array
97
97
98
98
if (($ this ->counter === 2 && count ($ params ) === 2 ) || !is_scalar ($ param )) {
99
99
$ res [] = $ this ->formatValue ($ param , self ::MODE_AUTO );
100
- $ this ->arrayMode = null ;
101
100
102
101
} elseif (is_string ($ param ) && $ this ->counter > $ prev + 1 ) {
103
102
$ prev = $ this ->counter ;
@@ -197,7 +196,7 @@ private function formatValue($value, string $mode = null): string
197
196
if ($ mode && is_array ($ value )) {
198
197
$ vx = $ kx = [];
199
198
if ($ mode === self ::MODE_AUTO ) {
200
- $ mode = $ this ->arrayMode ;
199
+ $ mode = $ this ->arrayMode ?? self :: MODE_LIST ;
201
200
}
202
201
203
202
if ($ mode === self ::MODE_VALUES ) { // (key, key, ...) VALUES (value, value, ...)
@@ -226,10 +225,10 @@ private function formatValue($value, string $mode = null): string
226
225
}
227
226
return '( ' . implode (', ' , $ kx ) . ') VALUES ( ' . implode (', ' , $ vx ) . ') ' ;
228
227
229
- } elseif (! $ mode || $ mode === self ::MODE_SET ) {
228
+ } elseif ($ mode === self ::MODE_SET ) {
230
229
foreach ($ value as $ k => $ v ) {
231
- if (is_int ($ k )) { // value, value, ... OR (1, 2), (3, 4)
232
- $ vx [] = is_array ( $ v ) ? ' ( ' . $ this -> formatValue ( $ v , self :: MODE_LIST ) . ' ) ' : $ this ->formatValue ($ v );
230
+ if (is_int ($ k )) { // value, value, ...
231
+ $ vx [] = $ this ->formatValue ($ v );
233
232
} elseif (substr ($ k , -1 ) === '= ' ) { // key+=value, key-=value, ...
234
233
$ k2 = $ this ->delimite (substr ($ k , 0 , -2 ));
235
234
$ vx [] = $ k2 . '= ' . $ k2 . ' ' . substr ($ k , -2 , 1 ) . ' ' . $ this ->formatValue ($ v );
0 commit comments