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

nette / assets / 22312221661

23 Feb 2026 03:14PM UTC coverage: 94.106% (+0.06%) from 94.048%
22312221661

push

github

dg
added CLAUDE.md

495 of 526 relevant lines covered (94.11%)

0.94 hits per line

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

94.44
/src/Assets/ScriptAsset.php
1
<?php declare(strict_types=1);
1✔
2

3
namespace Nette\Assets;
4

5
use Nette\Utils\Html;
6

7

8
/**
9
 * Script asset.
10
 */
11
class ScriptAsset implements Asset, HtmlRenderable
12
{
13
        public function __construct(
1✔
14
                public readonly string $url,
15
                public readonly ?string $file = null,
16
                public readonly ?string $type = null,
17
                /** SRI integrity hash */
18
                public readonly ?string $integrity = null,
19
                public readonly string|bool|null $crossorigin = null,
20
        ) {
21
        }
1✔
22

23

24
        public function __toString(): string
25
        {
26
                return $this->url;
×
27
        }
28

29

30
        public function getImportElement(): Html
31
        {
32
                return Html::el('script', array_filter([
1✔
33
                        'src' => $this->url,
1✔
34
                        'type' => $this->type,
1✔
35
                        'integrity' => $this->integrity,
1✔
36
                        'crossorigin' => $this->crossorigin ?? (bool) $this->integrity,
1✔
37
                ], fn($value) => $value !== null));
1✔
38
        }
39

40

41
        public function getPreloadElement(): Html
42
        {
43
                return Html::el('link', array_filter($this->type === 'module'
1✔
44
                        ? [
45
                                'rel' => 'modulepreload',
1✔
46
                                'href' => $this->url,
1✔
47
                                'crossorigin' => $this->crossorigin,
1✔
48
                        ]
49
                        : [
50
                                'rel' => 'preload',
1✔
51
                                'href' => $this->url,
1✔
52
                                'as' => 'script',
1✔
53
                                'crossorigin' => $this->crossorigin,
1✔
54
                        ]));
55
        }
56
}
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