Convert GetNonOrphanVisitsCommand to invokable command

This commit is contained in:
Alejandro Celaya
2025-12-17 15:22:56 +01:00
parent f9b1f0ebf4
commit 66d35968f4
6 changed files with 110 additions and 70 deletions

View File

@@ -0,0 +1,28 @@
<?php
declare(strict_types=1);
namespace Shlinkio\Shlink\CLI\Input;
use Shlinkio\Shlink\Common\Util\DateRange;
use Symfony\Component\Console\Attribute\Option;
use function Shlinkio\Shlink\Common\buildDateRange;
use function Shlinkio\Shlink\Core\normalizeOptionalDate;
class VisitsDateRangeInput
{
#[Option('Only return visits older than this date', shortcut: 's')]
public string|null $startDate = null;
#[Option('Only return visits newer than this date', shortcut: 'e')]
public string|null $endDate = null;
public function toDateRange(): DateRange
{
return buildDateRange(
startDate: normalizeOptionalDate($this->startDate),
endDate: normalizeOptionalDate($this->endDate),
);
}
}