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

MyIntervals / PHP-CSS-Parser / 13887271791

16 Mar 2025 08:52PM UTC coverage: 56.036%. Remained the same
13887271791

Pull #818

github

web-flow
Merge af1b6618e into 4312c56fc
Pull Request #818: [TASK] Use native types for all constructor parameters

4 of 7 new or added lines in 7 files covered. (57.14%)

3 existing lines in 1 file now uncovered.

1049 of 1872 relevant lines covered (56.04%)

12.69 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
use Sabberworm\CSS\Value\CSSString;
10
use Sabberworm\CSS\Value\URL;
11

12
/**
13
 * `CSSNamespace` represents an `@namespace` rule.
14
 */
15
class CSSNamespace implements AtRule
16
{
17
    /**
18
     * @var CSSString|URL
19
     */
20
    private $url;
21

22
    /**
23
     * @var string
24
     */
25
    private $prefix;
26

27
    /**
28
     * @var int<0, max> $lineNumber
29
     */
30
    private $lineNumber;
31

32
    /**
33
     * @var list<Comment>
34
     *
35
     * @internal since 8.8.0
36
     */
37
    protected $comments = [];
38

39
    /**
40
     * @param CSSString|URL $url
41
     * @param int<0, max> $lineNumber
42
     */
NEW
43
    public function __construct($url, ?string $prefix = null, int $lineNumber = 0)
×
44
    {
45
        $this->url = $url;
×
46
        $this->prefix = $prefix;
×
47
        $this->lineNumber = $lineNumber;
×
48
    }
×
49

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

58
    /**
59
     * @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
60
     */
61
    public function __toString(): string
×
62
    {
63
        return $this->render(new OutputFormat());
×
64
    }
65

66
    public function render(OutputFormat $outputFormat): string
×
67
    {
68
        return '@namespace ' . ($this->prefix === null ? '' : $this->prefix . ' ')
×
69
            . $this->url->render($outputFormat) . ';';
×
70
    }
71

72
    /**
73
     * @return CSSString|URL
74
     */
75
    public function getUrl()
×
76
    {
77
        return $this->url;
×
78
    }
79

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

88
    /**
89
     * @param CSSString|URL $url
90
     */
91
    public function setUrl($url): void
×
92
    {
93
        $this->url = $url;
×
94
    }
×
95

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

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

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

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

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

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