Skip to content

Commit b6b8c31

Browse files
committed
refactor: use if statement
1 parent bec6422 commit b6b8c31

File tree

1 file changed

+19
-9
lines changed

1 file changed

+19
-9
lines changed

system/Database/Postgre/Builder.php

Lines changed: 19 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -566,15 +566,25 @@ protected function _deleteBatch(string $table, array $keys, array $values): stri
566566
$sql .= 'WHERE ' . implode(
567567
' AND ',
568568
array_map(
569-
static fn ($key, $value) => (
570-
$value instanceof RawSql ?
571-
$value :
572-
(
573-
is_string($key) ?
574-
$table . '.' . $key . ' = ' . $that->cast($alias . '.' . $value, $that->getFieldType($table, $key)) :
575-
$table . '.' . $value . ' = ' . $that->cast($alias . '.' . $value, $that->getFieldType($table, $key))
576-
)
577-
),
569+
static function ($key, $value) use ($table, $alias, $that) {
570+
if ($value instanceof RawSql) {
571+
return $value;
572+
}
573+
574+
if (is_string($key)) {
575+
return $table . '.' . $key . ' = '
576+
. $that->cast(
577+
$alias . '.' . $value,
578+
$that->getFieldType($table, $key)
579+
);
580+
}
581+
582+
return $table . '.' . $value . ' = '
583+
. $that->cast(
584+
$alias . '.' . $value,
585+
$that->getFieldType($table, $key)
586+
);
587+
},
578588
array_keys($constraints),
579589
$constraints
580590
)

0 commit comments

Comments
 (0)