• 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

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

3
namespace Nette\Assets;
4

5
use Nette\Utils\Html;
6

7

8
/**
9
 * Font asset.
10
 */
11
class FontAsset implements Asset, HtmlRenderable
12
{
13
        public readonly ?string $mimeType;
14

15

16
        public function __construct(
1✔
17
                public readonly string $url,
18
                public readonly ?string $file = null,
19
                ?string $mimeType = null,
20
                /** SRI integrity hash */
21
                public readonly ?string $integrity = null,
22
        ) {
23
                $this->mimeType = $mimeType ?? Helpers::guessMimeTypeFromExtension($file ?? $url);
1✔
24
        }
1✔
25

26

27
        public function __toString(): string
28
        {
29
                return $this->url;
×
30
        }
31

32

33
        public function getImportElement(): Html
34
        {
35
                return Html::el('link', array_filter([
1✔
36
                        'rel' => 'preload',
1✔
37
                        'href' => $this->url,
1✔
38
                        'as' => 'font',
1✔
39
                        'type' => $this->mimeType,
1✔
40
                        'crossorigin' => true,
41
                        'integrity' => $this->integrity,
1✔
42
                ], fn($value) => $value !== null));
1✔
43
        }
44

45

46
        public function getPreloadElement(): Html
47
        {
48
                return $this->getImportElement();
1✔
49
        }
50
}
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