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

MyIntervals / PHP-CSS-Parser / 13226444511

09 Feb 2025 02:05PM UTC coverage: 49.156%. Remained the same
13226444511

Pull #888

github

web-flow
Merge b7f855337 into f7914f8b4
Pull Request #888: [TASK] Make constructors of CSS element classes `@internal`

932 of 1896 relevant lines covered (49.16%)

10.91 hits per line

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

0.0
/src/Property/CSSNamespace.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

10
/**
11
 * `CSSNamespace` represents an `@namespace` rule.
12
 */
13
class CSSNamespace implements AtRule
14
{
15
    /**
16
     * @var string
17
     */
18
    private $mUrl;
19

20
    /**
21
     * @var string
22
     */
23
    private $sPrefix;
24

25
    /**
26
     * @var int
27
     */
28
    private $lineNumber;
29

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

37
    /**
38
     * @param string $mUrl
39
     * @param string|null $sPrefix
40
     * @param int $lineNumber
41
     *
42
     * @internal since 8.8.0
43
     */
44
    public function __construct($mUrl, $sPrefix = null, $lineNumber = 0)
×
45
    {
46
        $this->mUrl = $mUrl;
×
47
        $this->sPrefix = $sPrefix;
×
48
        $this->lineNumber = $lineNumber;
×
49
        $this->comments = [];
×
50
    }
×
51

52
    /**
53
     * @return int
54
     */
55
    public function getLineNo()
×
56
    {
57
        return $this->lineNumber;
×
58
    }
59

60
    public function __toString(): string
×
61
    {
62
        return $this->render(new OutputFormat());
×
63
    }
64

65
    public function render(OutputFormat $oOutputFormat): string
×
66
    {
67
        return '@namespace ' . ($this->sPrefix === null ? '' : $this->sPrefix . ' ')
×
68
            . $this->mUrl->render($oOutputFormat) . ';';
×
69
    }
70

71
    /**
72
     * @return string
73
     */
74
    public function getUrl()
×
75
    {
76
        return $this->mUrl;
×
77
    }
78

79
    /**
80
     * @return string|null
81
     */
82
    public function getPrefix()
×
83
    {
84
        return $this->sPrefix;
×
85
    }
86

87
    /**
88
     * @param string $mUrl
89
     */
90
    public function setUrl($mUrl): void
×
91
    {
92
        $this->mUrl = $mUrl;
×
93
    }
×
94

95
    /**
96
     * @param string $sPrefix
97
     */
98
    public function setPrefix($sPrefix): void
×
99
    {
100
        $this->sPrefix = $sPrefix;
×
101
    }
×
102

103
    /**
104
     * @return string
105
     */
106
    public function atRuleName(): string
×
107
    {
108
        return 'namespace';
×
109
    }
110

111
    /**
112
     * @return array<int, string>
113
     */
114
    public function atRuleArgs(): array
×
115
    {
116
        $aResult = [$this->mUrl];
×
117
        if ($this->sPrefix) {
×
118
            \array_unshift($aResult, $this->sPrefix);
×
119
        }
120
        return $aResult;
×
121
    }
122

123
    /**
124
     * @param array<array-key, Comment> $comments
125
     */
126
    public function addComments(array $comments): void
×
127
    {
128
        $this->comments = \array_merge($this->comments, $comments);
×
129
    }
×
130

131
    /**
132
     * @return array<array-key, Comment>
133
     */
134
    public function getComments()
×
135
    {
136
        return $this->comments;
×
137
    }
138

139
    /**
140
     * @param array<array-key, Comment> $comments
141
     */
142
    public function setComments(array $comments): void
×
143
    {
144
        $this->comments = $comments;
×
145
    }
×
146
}
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