• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

NeoIsRecursive / inertia-tempest / 23818075116

31 Mar 2026 08:32PM UTC coverage: 92.754% (-6.1%) from 98.81%
23818075116

Pull #23

github

web-flow
Merge 31eb93d0a into 46d3a3fe6
Pull Request #23: feat: inertia 3

221 of 245 new or added lines in 21 files covered. (90.2%)

8 existing lines in 1 file now uncovered.

320 of 345 relevant lines covered (92.75%)

18.92 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

88.24
/src/Concerns/IsOnceProp.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace NeoIsRecursive\Inertia\Concerns;
6

7
use BackedEnum;
8
use DateInterval;
9
use DateTimeImmutable;
10
use DateTimeInterface;
11
use UnitEnum;
12

13
trait IsOnceProp
14
{
15
    protected bool $resolveOnce = false;
16
    protected bool $refreshOnce = false;
17
    protected ?string $onceKey = null;
18
    protected ?int $onceExpiresAt = null;
19

20
    public function once(): static
21
    {
22
        return clone($this, ['resolveOnce' => true]);
10✔
23
    }
24

25
    public function shouldResolveOnce(): bool
26
    {
27
        return $this->resolveOnce;
25✔
28
    }
29

30
    public function fresh(): static
31
    {
32
        return clone($this, ['refreshOnce' => true]);
1✔
33
    }
34

35
    public function shouldBeRefreshed(): bool
36
    {
37
        return $this->refreshOnce;
9✔
38
    }
39

40
    public function as(BackedEnum|UnitEnum|string $key): static
41
    {
42
        return clone($this, ['onceKey' => match (true) {
1✔
43
            $key instanceof BackedEnum => (string) $key->value,
1✔
44
            $key instanceof UnitEnum => $key->name,
1✔
45
            default => $key,
1✔
46
        }]);
1✔
47
    }
48

49
    public function getKey(): ?string
50
    {
51
        return $this->onceKey;
10✔
52
    }
53

54
    public function until(DateTimeInterface|DateInterval|int $delay): static
55
    {
56
        $expiresAt = match (true) {
1✔
57
            $delay instanceof DateTimeInterface => DateTimeImmutable::createFromInterface($delay),
1✔
NEW
58
            $delay instanceof DateInterval => new DateTimeImmutable()->add($delay),
×
NEW
59
            default => new DateTimeImmutable()->modify(sprintf('+%d seconds', $delay)),
×
60
        };
1✔
61

62
        return clone($this, ['onceExpiresAt' => (int) $expiresAt->format('Uv')]);
1✔
63
    }
64

65
    public function expiresAt(): ?int
66
    {
67
        return $this->onceExpiresAt;
10✔
68
    }
69
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc