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

MyIntervals / PHP-CSS-Parser / 12967903681

25 Jan 2025 07:43PM UTC coverage: 42.138%. Remained the same
12967903681

Pull #805

github

web-flow
Merge 1c5a672ee into 24f44c2ad
Pull Request #805: [TASK] Use native `void` return type declarations

0 of 4 new or added lines in 1 file covered. (0.0%)

5 existing lines in 3 files now uncovered.

871 of 2067 relevant lines covered (42.14%)

6.56 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
28
     */
29
    protected $iLineNo;
30

31
    /**
32
     * @var array<array-key, Comment>
33
     */
34
    protected $comments;
35

36
    /**
37
     * @param CSSString $oCharset
38
     * @param int $iLineNo
39
     */
40
    public function __construct(CSSString $oCharset, $iLineNo = 0)
×
41
    {
42
        $this->oCharset = $oCharset;
×
43
        $this->iLineNo = $iLineNo;
×
44
        $this->comments = [];
×
45
    }
×
46

47
    /**
48
     * @return int
49
     */
50
    public function getLineNo()
×
51
    {
52
        return $this->iLineNo;
×
53
    }
54

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

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

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

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

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

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

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

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

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