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

MyIntervals / PHP-CSS-Parser / 14088701374

26 Mar 2025 04:38PM UTC coverage: 52.82%. Remained the same
14088701374

Pull #1219

github

web-flow
Merge 33f0db510 into 8104f52af
Pull Request #1219: [TASK] Prevent Dependabot updating "rawr/cross-data-providers"

946 of 1791 relevant lines covered (52.82%)

7.05 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\CommentContainer;
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
    use CommentContainer;
18

19
    /**
20
     * @var CSSString|URL
21
     */
22
    private $url;
23

24
    /**
25
     * @var string|null
26
     */
27
    private $prefix;
28

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

34
    /**
35
     * @param CSSString|URL $url
36
     * @param int<0, max> $lineNumber
37
     */
38
    public function __construct($url, ?string $prefix = null, int $lineNumber = 0)
×
39
    {
40
        $this->url = $url;
×
41
        $this->prefix = $prefix;
×
42
        $this->lineNumber = $lineNumber;
×
43
    }
×
44

45
    /**
46
     * @return int<0, max>
47
     */
48
    public function getLineNo(): int
×
49
    {
50
        return $this->lineNumber;
×
51
    }
52

53
    /**
54
     * @return non-empty-string
55
     */
56
    public function render(OutputFormat $outputFormat): string
×
57
    {
58
        return '@namespace ' . ($this->prefix === null ? '' : $this->prefix . ' ')
×
59
            . $this->url->render($outputFormat) . ';';
×
60
    }
61

62
    /**
63
     * @return CSSString|URL
64
     */
65
    public function getUrl()
×
66
    {
67
        return $this->url;
×
68
    }
69

70
    public function getPrefix(): ?string
×
71
    {
72
        return $this->prefix;
×
73
    }
74

75
    /**
76
     * @param CSSString|URL $url
77
     */
78
    public function setUrl($url): void
×
79
    {
80
        $this->url = $url;
×
81
    }
×
82

83
    public function setPrefix(string $prefix): void
×
84
    {
85
        $this->prefix = $prefix;
×
86
    }
×
87

88
    /**
89
     * @return non-empty-string
90
     */
91
    public function atRuleName(): string
×
92
    {
93
        return 'namespace';
×
94
    }
95

96
    /**
97
     * @return array{0: CSSString|URL|non-empty-string, 1?: CSSString|URL}
98
     */
99
    public function atRuleArgs(): array
×
100
    {
101
        $result = [$this->url];
×
102
        if (\is_string($this->prefix) && $this->prefix !== '') {
×
103
            \array_unshift($result, $this->prefix);
×
104
        }
105
        return $result;
×
106
    }
107
}
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