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
TimeCommand 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 Stewart\Contracts\Exposure\CalendarStateFormat;
8use Stewart\Contracts\Exposure\ExposedState;
9use Stewart\Contracts\Schedule\TimeOfDay;
10use Stewart\Contracts\State\EventContext;
11
12final readonly class TimeCommand implements ExposedCommand
13{
14    public function __construct(
15        public TimeOfDay $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::formatTime($this->value));
27    }
28}