Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
CRAP | |
100.00% |
1 / 1 |
| EventQuery | |
100.00% |
2 / 2 |
|
100.00% |
2 / 2 |
2 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| all | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Server\Spi; |
| 6 | |
| 7 | use DateTimeImmutable; |
| 8 | |
| 9 | /** |
| 10 | * The filters of GET /logistics-objects/{id}/logistics-events. |
| 11 | */ |
| 12 | final readonly class EventQuery |
| 13 | { |
| 14 | public const string SORT_CREATED_ASC = 'ASC-creationDate'; |
| 15 | public const string SORT_CREATED_DESC = 'DESC-creationDate'; |
| 16 | public const string SORT_EVENT_ASC = 'ASC-eventDate'; |
| 17 | public const string SORT_EVENT_DESC = 'DESC-eventDate'; |
| 18 | |
| 19 | /** |
| 20 | * @param list<string> $eventCodes codes the event code must match (any of) |
| 21 | */ |
| 22 | public function __construct( |
| 23 | public array $eventCodes = [], |
| 24 | public ?DateTimeImmutable $createdAfter = null, |
| 25 | public ?DateTimeImmutable $createdBefore = null, |
| 26 | public ?DateTimeImmutable $occurredAfter = null, |
| 27 | public ?DateTimeImmutable $occurredBefore = null, |
| 28 | public string $sort = self::SORT_CREATED_ASC, |
| 29 | public ?int $limit = null, |
| 30 | public int $skip = 0, |
| 31 | ) {} |
| 32 | |
| 33 | public static function all(): self |
| 34 | { |
| 35 | return new self(); |
| 36 | } |
| 37 | } |