Lines 100.00% 4 / 4
Methods 100.00% 2 / 2
Classes 100.00% 1 / 1
Name Lines Methods CRAP
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 createSunCalendar 100.00% 3 / 3 100.00% 1 / 1 2
14final readonly class WorkerSunCalendarFactory
15{
16    public function __construct(
17        private Bootstrap $bootstrap,
18        private Clock $clock,
19        private NoaaSolarCalculator $calculator,
20    ) {}
21
22    public function createSunCalendar(): SunCalendar
23    {
24        if ($this->bootstrap->location === null) {
25            return new UnlocatedSunCalendar();
26        }
27
28        return new LocatedSunCalendar($this->bootstrap->location, $this->clock, $this->calculator);
29    }
30}