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

MyIntervals / PHP-CSS-Parser / 13379632924

17 Feb 2025 10:38PM UTC coverage: 51.335%. Remained the same
13379632924

Pull #948

github

web-flow
Merge cd6ef6f55 into 45262028e
Pull Request #948: [CLEANUP] Avoid Hungarian notation for `charset`

0 of 12 new or added lines in 2 files covered. (0.0%)

1 existing line in 1 file now uncovered.

961 of 1872 relevant lines covered (51.34%)

11.55 hits per line

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

0.0
/src/Property/Charset.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Sabberworm\CSS\Property;
6

7
use Sabberworm\CSS\Comment\Comment;
8
use Sabberworm\CSS\OutputFormat;
9
use Sabberworm\CSS\Value\CSSString;
10

11
/**
12
 * Class representing an `@charset` rule.
13
 *
14
 * The following restrictions apply:
15
 * - May not be found in any CSSList other than the Document.
16
 * - May only appear at the very top of a Document’s contents.
17
 * - Must not appear more than once.
18
 */
19
class Charset implements AtRule
20
{
21
    /**
22
     * @var CSSString
23
     */
24
    private $oCharset;
25

26
    /**
27
     * @var int<0, max>
28
     *
29
     * @internal since 8.8.0
30
     */
31
    protected $lineNumber;
32

33
    /**
34
     * @var array<array-key, Comment>
35
     *
36
     * @internal since 8.8.0
37
     */
38
    protected $comments = [];
39

40
    /**
41
     * @param int<0, max> $lineNumber
42
     */
43
    public function __construct(CSSString $oCharset, $lineNumber = 0)
×
44
    {
45
        $this->oCharset = $oCharset;
×
46
        $this->lineNumber = $lineNumber;
×
47
    }
×
48

49
    /**
50
     * @return int<0, max>
51
     */
52
    public function getLineNo(): int
×
53
    {
54
        return $this->lineNumber;
×
55
    }
56

57
    /**
58
     * @param string|CSSString $charset
59
     */
NEW
60
    public function setCharset($charset): void
×
61
    {
NEW
62
        $charset = $charset instanceof CSSString ? $charset : new CSSString($charset);
×
NEW
63
        $this->oCharset = $charset;
×
UNCOV
64
    }
×
65

66
    /**
67
     * @return string
68
     */
69
    public function getCharset()
×
70
    {
71
        return $this->oCharset->getString();
×
72
    }
73

74
    public function __toString(): string
×
75
    {
76
        return $this->render(new OutputFormat());
×
77
    }
78

79
    public function render(OutputFormat $outputFormat): string
×
80
    {
81
        return "{$outputFormat->comments($this)}@charset {$this->oCharset->render($outputFormat)};";
×
82
    }
83

84
    public function atRuleName(): string
×
85
    {
86
        return 'charset';
×
87
    }
88

89
    /**
90
     * @return string
91
     */
92
    public function atRuleArgs()
×
93
    {
94
        return $this->oCharset;
×
95
    }
96

97
    /**
98
     * @param array<array-key, Comment> $comments
99
     */
100
    public function addComments(array $comments): void
×
101
    {
102
        $this->comments = \array_merge($this->comments, $comments);
×
103
    }
×
104

105
    /**
106
     * @return array<array-key, Comment>
107
     */
108
    public function getComments()
×
109
    {
110
        return $this->comments;
×
111
    }
112

113
    /**
114
     * @param array<array-key, Comment> $comments
115
     */
116
    public function setComments(array $comments): void
×
117
    {
118
        $this->comments = $comments;
×
119
    }
×
120
}
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