Modernize ApiKey entity

This commit is contained in:
Alejandro Celaya
2024-03-18 18:33:56 +01:00
parent ab8fa52ca4
commit 60e9443b12
4 changed files with 14 additions and 31 deletions

View File

@@ -50,11 +50,11 @@ class ListKeysCommand extends Command
$enabledOnly = $input->getOption('enabled-only');
$rows = array_map(function (ApiKey $apiKey) use ($enabledOnly) {
$expiration = $apiKey->getExpirationDate();
$expiration = $apiKey->expirationDate;
$messagePattern = $this->determineMessagePattern($apiKey);
// Set columns for this row
$rowData = [sprintf($messagePattern, $apiKey), sprintf($messagePattern, $apiKey->name() ?? '-')];
$rowData = [sprintf($messagePattern, $apiKey), sprintf($messagePattern, $apiKey->name ?? '-')];
if (! $enabledOnly) {
$rowData[] = sprintf($messagePattern, $this->getEnabledSymbol($apiKey));
}

View File

@@ -233,7 +233,7 @@ class ListShortUrlsCommand extends Command
}
if ($input->getOption('show-api-key-name')) {
$columnsMap['API Key Name'] = static fn (array $_, ShortUrl $shortUrl): ?string =>
$shortUrl->authorApiKey()?->name();
$shortUrl->authorApiKey()?->name;
}
return $columnsMap;