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

MyIntervals / PHP-CSS-Parser / 16112982700

07 Jul 2025 09:18AM UTC coverage: 57.935%. Remained the same
16112982700

Pull #1307

github

web-flow
Merge 81b4533d5 into 674cfa00c
Pull Request #1307: [DOCS] Temporarily drop some markers from the class diagram

1055 of 1821 relevant lines covered (57.94%)

16.67 hits per line

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

20.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\Position\Position;
10
use Sabberworm\CSS\Position\Positionable;
11
use Sabberworm\CSS\Value\CSSString;
12
use Sabberworm\CSS\Value\URL;
13

14
/**
15
 * `CSSNamespace` represents an `@namespace` rule.
16
 */
17
class CSSNamespace implements AtRule, Positionable
18
{
19
    use CommentContainer;
20
    use Position;
21

22
    /**
23
     * @var CSSString|URL
24
     */
25
    private $url;
26

27
    /**
28
     * @var string|null
29
     */
30
    private $prefix;
31

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

43
    /**
44
     * @return non-empty-string
45
     */
46
    public function render(OutputFormat $outputFormat): string
×
47
    {
48
        return '@namespace ' . ($this->prefix === null ? '' : $this->prefix . ' ')
×
49
            . $this->url->render($outputFormat) . ';';
×
50
    }
51

52
    /**
53
     * @return CSSString|URL
54
     */
55
    public function getUrl()
×
56
    {
57
        return $this->url;
×
58
    }
59

60
    public function getPrefix(): ?string
×
61
    {
62
        return $this->prefix;
×
63
    }
64

65
    /**
66
     * @param CSSString|URL $url
67
     */
68
    public function setUrl($url): void
×
69
    {
70
        $this->url = $url;
×
71
    }
×
72

73
    public function setPrefix(string $prefix): void
×
74
    {
75
        $this->prefix = $prefix;
×
76
    }
×
77

78
    /**
79
     * @return non-empty-string
80
     */
81
    public function atRuleName(): string
×
82
    {
83
        return 'namespace';
×
84
    }
85

86
    /**
87
     * @return array{0: CSSString|URL|non-empty-string, 1?: CSSString|URL}
88
     */
89
    public function atRuleArgs(): array
×
90
    {
91
        $result = [$this->url];
×
92
        if (\is_string($this->prefix) && $this->prefix !== '') {
×
93
            \array_unshift($result, $this->prefix);
×
94
        }
95
        return $result;
×
96
    }
97
}
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

© 2025 Coveralls, Inc