Improve code formatting and readability in AuditLogManager by adjusting array handling and binding statements
This commit is contained in:
parent
1739c8dd59
commit
e72a03cb10
1 changed files with 6 additions and 1 deletions
|
@ -213,8 +213,10 @@
|
||||||
{
|
{
|
||||||
throw new InvalidArgumentException("All filterType elements must be of type AuditLogType.");
|
throw new InvalidArgumentException("All filterType elements must be of type AuditLogType.");
|
||||||
}
|
}
|
||||||
|
|
||||||
$params[":type$i"] = $t->value;
|
$params[":type$i"] = $t->value;
|
||||||
}
|
}
|
||||||
|
|
||||||
$placeholders = implode(", ", array_keys(array_slice($params, 1)));
|
$placeholders = implode(", ", array_keys(array_slice($params, 1)));
|
||||||
$sql .= " AND type IN ($placeholders)";
|
$sql .= " AND type IN ($placeholders)";
|
||||||
}
|
}
|
||||||
|
@ -222,9 +224,12 @@
|
||||||
$sql .= " ORDER BY timestamp DESC LIMIT :limit OFFSET :offset";
|
$sql .= " ORDER BY timestamp DESC LIMIT :limit OFFSET :offset";
|
||||||
|
|
||||||
$stmt = DatabaseConnection::getConnection()->prepare($sql);
|
$stmt = DatabaseConnection::getConnection()->prepare($sql);
|
||||||
foreach ($params as $key => $value) {
|
|
||||||
|
foreach ($params as $key => $value)
|
||||||
|
{
|
||||||
$stmt->bindValue($key, $value);
|
$stmt->bindValue($key, $value);
|
||||||
}
|
}
|
||||||
|
|
||||||
$stmt->bindValue(':limit', $limit, PDO::PARAM_INT);
|
$stmt->bindValue(':limit', $limit, PDO::PARAM_INT);
|
||||||
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
$stmt->bindValue(':offset', $offset, PDO::PARAM_INT);
|
||||||
$stmt->execute();
|
$stmt->execute();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue