@@ -97,7 +97,6 @@ public function process(array $params, bool $useParams = false): array
9797
9898 if (($ this ->counter === 2 && count ($ params ) === 2 ) || !is_scalar ($ param )) {
9999 $ res [] = $ this ->formatValue ($ param , self ::MODE_AUTO );
100- $ this ->arrayMode = null ;
101100
102101 } elseif (is_string ($ param ) && $ this ->counter > $ prev + 1 ) {
103102 $ prev = $ this ->counter ;
@@ -197,7 +196,7 @@ private function formatValue($value, string $mode = null): string
197196 if ($ mode && is_array ($ value )) {
198197 $ vx = $ kx = [];
199198 if ($ mode === self ::MODE_AUTO ) {
200- $ mode = $ this ->arrayMode ;
199+ $ mode = $ this ->arrayMode ?? self :: MODE_LIST ;
201200 }
202201
203202 if ($ mode === self ::MODE_VALUES ) { // (key, key, ...) VALUES (value, value, ...)
@@ -226,10 +225,10 @@ private function formatValue($value, string $mode = null): string
226225 }
227226 return '( ' . implode (', ' , $ kx ) . ') VALUES ( ' . implode (', ' , $ vx ) . ') ' ;
228227
229- } elseif (! $ mode || $ mode === self ::MODE_SET ) {
228+ } elseif ($ mode === self ::MODE_SET ) {
230229 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 );
233232 } elseif (substr ($ k , -1 ) === '= ' ) { // key+=value, key-=value, ...
234233 $ k2 = $ this ->delimite (substr ($ k , 0 , -2 ));
235234 $ vx [] = $ k2 . '= ' . $ k2 . ' ' . substr ($ k , -2 , 1 ) . ' ' . $ this ->formatValue ($ v );
0 commit comments