Lines 0.00% 0 / 3
Functions and Methods 0.00% 0 / 3
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
DateTimeCommand 0.00% 0 / 3 0.00% 0 / 3 12 0.00% 0 / 1
 __construct 0.00% 0 / 1 0.00% 0 / 1 2
 getContext 0.00% 0 / 1 0.00% 0 / 1 2
 getRequestedState 0.00% 0 / 1 0.00% 0 / 1 2
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Contracts\Exposure\Command;
6
7use DateTimeImmutable;
8use Stewart\Contracts\Exposure\CalendarStateFormat;
9use Stewart\Contracts\Exposure\ExposedState;
10use Stewart\Contracts\State\EventContext;
11
12final readonly class DateTimeCommand implements ExposedCommand
13{
14    public function __construct(
15        public DateTimeImmutable $value,
16        public EventContext $context,
17    ) {}
18
19    public function getContext(): EventContext
20    {
21        return $this->context;
22    }
23
24    public function getRequestedState(): ExposedState
25    {
26        return new ExposedState(CalendarStateFormat::formatDateTime($this->value));
27    }
28}