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

NeoIsRecursive / inertia-tempest / 16472861501

23 Jul 2025 02:01PM UTC coverage: 99.533% (-0.5%) from 100.0%
16472861501

Pull #13

github

web-flow
Merge 45b1e488b into 3bb57470f
Pull Request #13: refactor: page data

38 of 39 new or added lines in 3 files covered. (97.44%)

213 of 214 relevant lines covered (99.53%)

13.57 hits per line

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

95.45
/src/PageData.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace NeoIsRecursive\Inertia;
6

7
use JsonSerializable;
8
use Tempest\Support\Html\HtmlString;
9

10
final readonly class PageData implements JsonSerializable
11
{
12
    // @mago-expect maintainability/excessive-parameter-list
13
    public function __construct(
14
        public string $component,
15
        public array $props,
16
        public string $url,
17
        public string $version,
18
        public bool $clearHistory,
19
        public bool $encryptHistory,
20
        public null|array $deferredProps = null,
21
        public null|array $mergeProps = null,
22
    ) {}
23✔
23

24
    public function toArray(): array
25
    {
26
        $data = [
18✔
27
            'component' => $this->component,
18✔
28
            'props' => $this->props,
18✔
29
            'url' => $this->url,
18✔
30
            'version' => $this->version,
18✔
31
            'clearHistory' => $this->clearHistory,
18✔
32
            'encryptHistory' => $this->encryptHistory,
18✔
33
        ];
18✔
34

35
        if ($this->deferredProps !== null) {
18✔
36
            $data['deferredProps'] = $this->deferredProps;
2✔
37
        }
38

39
        if ($this->mergeProps !== null) {
18✔
NEW
40
            $data['mergeProps'] = $this->mergeProps;
×
41
        }
42

43
        return $data;
18✔
44
    }
45

46
    public function jsonSerialize(): array
47
    {
48
        return $this->toArray();
1✔
49
    }
50

51
    public function render(string $id): HtmlString
52
    {
53
        return HtmlString::createTag(
1✔
54
            'div',
1✔
55
            [
1✔
56
                'id' => $id,
1✔
57
                'data-page' => htmlentities(json_encode($this, JSON_THROW_ON_ERROR)),
1✔
58
            ],
1✔
59
        );
1✔
60
    }
61
}
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