Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
CRAP
100.00% covered (success)
100.00%
1 / 1
FontFeatureValue
100.00% covered (success)
100.00%
2 / 2
100.00% covered (success)
100.00%
2 / 2
2
100.00% covered (success)
100.00%
1 / 1
 __construct
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
 toCss
100.00% covered (success)
100.00%
1 / 1
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\Css\Value;
6
7/**
8 * One `<feature-tag> <integer-or-on-off>?` entry inside a
9 * CSS Fonts 4 ยง6.4 `font-feature-settings` declaration.
10 *
11 *   "tnum" 1     โ†’ tag="tnum", value=1   (enable)
12 *   "liga" off   โ†’ tag="liga", value=0
13 *   "ss01"       โ†’ tag="ss01", value=1   (default on)
14 */
15final readonly class FontFeatureValue
16{
17    public function __construct(
18        public string $tag,
19        public int $value = 1,
20    ) {}
21
22    public function toCss(): string
23    {
24        return sprintf('"%s" %d', $this->tag, $this->value);
25    }
26}