Skip to content

Commit

Permalink
update names to avoid misunderstandings with the word "magic"
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Steffens <florian.steffens@nextcloud.com>
  • Loading branch information
Florian Steffens committed Jan 11, 2024
1 parent 490cf35 commit 49152ba
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/Db/RowMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ private function getRows(array $rowIds, array $columnIds): array {
*/
private function addFilterToQuery(IQueryBuilder &$qb, array $filters, string $userId): void {
// TODO move this into service
$this->replaceMagicValues($filters, $userId);
$this->replacePlaceholderValues($filters, $userId);

if (count($filters) > 0) {
$qb->andWhere(
Expand All @@ -224,7 +224,7 @@ private function addFilterToQuery(IQueryBuilder &$qb, array $filters, string $us
}
}

private function replaceMagicValues(array &$filters, string $userId): void {
private function replacePlaceholderValues(array &$filters, string $userId): void {
foreach ($filters as &$filterGroup) {
foreach ($filterGroup as &$filter) {
if(substr($filter['value'], 0, 1) === '@') {
Expand Down Expand Up @@ -307,8 +307,8 @@ private function getFilterExpression(IQueryBuilder $qb, Column $column, string $
}

/** @noinspection DuplicatedCode */
private function resolveSearchValue(string $magicValue, string $userId): string {
switch (ltrim($magicValue, '@')) {
private function resolveSearchValue(string $placeholder, string $userId): string {
switch (ltrim($placeholder, '@')) {
case 'me': return $userId;
case 'my-name': return $this->userHelper->getUserDisplayName($userId);
case 'checked': return 'true';
Expand All @@ -328,7 +328,7 @@ private function resolveSearchValue(string $magicValue, string $userId): string
return $result ?: '';
case 'datetime-time-now': return date('H:i');
case 'datetime-now': return date('Y-m-d H:i') ? date('Y-m-d H:i') : '';
default: return $magicValue;
default: return $placeholder;
}
}

Expand Down

0 comments on commit 49152ba

Please sign in to comment.