Lines 80.00% 4 / 5
Functions and Methods 80.00% 4 / 5
Classes and Traits 0.00% 0 / 1
Name Lines Functions and Methods CRAP Classes and Traits
ScheduledTaskHandle 80.00% 4 / 5 80.00% 4 / 5 5.20 0.00% 0 / 1
 __construct 100.00% 1 / 1 100.00% 1 / 1 1
 getId 0.00% 0 / 1 0.00% 0 / 1 2
 cancel 100.00% 1 / 1 100.00% 1 / 1 1
 isActive 100.00% 1 / 1 100.00% 1 / 1 1
 getNextRunAt 100.00% 1 / 1 100.00% 1 / 1 1
1<?php
2
3declare(strict_types=1);
4
5namespace Stewart\Runtime\Schedule;
6
7use Stewart\Contracts\Schedule\ScheduledTask;
8use Stewart\Contracts\Time\Instant;
9
10final readonly class ScheduledTaskHandle implements ScheduledTask
11{
12    public function __construct(private ScheduleEntry $entry) {}
13
14    public function getId(): string
15    {
16        return $this->entry->origin->taskId;
17    }
18
19    public function cancel(): void
20    {
21        $this->entry->cancel();
22    }
23
24    public function isActive(): bool
25    {
26        return $this->entry->active;
27    }
28
29    public function getNextRunAt(): ?Instant
30    {
31        return $this->entry->getNextRunAt();
32    }
33}