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

nette / assets / 15009594433

14 May 2025 12:38AM UTC coverage: 95.411% (+2.0%) from 93.401%
15009594433

push

github

dg
readme: added info about custom mappers

395 of 414 relevant lines covered (95.41%)

0.95 hits per line

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

91.67
/src/Assets/FontAsset.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Nette\Assets;
6

7
use Nette\Utils\Html;
8

9

10
/**
11
 * Font asset.
12
 */
13
class FontAsset implements Asset, HtmlRenderable
14
{
15
        public function __construct(
1✔
16
                public readonly string $url,
17
                public readonly ?string $mimeType = null,
18
                public readonly ?string $sourcePath = null,
19
                /** SRI integrity hash */
20
                public readonly ?string $integrity = null,
21
        ) {
22
        }
1✔
23

24

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

30

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

43

44
        public function getHtmlPreloadElement(): Html
45
        {
46
                return $this->getHtmlElement();
1✔
47
        }
48
}
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