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

MyIntervals / PHP-CSS-Parser / 13506152747

24 Feb 2025 07:25PM UTC coverage: 53.705%. Remained the same
13506152747

push

github

web-flow
[CLEANUP] Avoid Hungarian notation in `CSSNamespace` (#985)

Part of #756

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

1022 of 1903 relevant lines covered (53.7%)

12.0 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 $url;
19

20
    /**
21
     * @var string
22
     */
23
    private $prefix;
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 $url
39
     * @param string|null $prefix
40
     * @param int<0, max> $lineNumber
41
     */
NEW
42
    public function __construct($url, $prefix = null, $lineNumber = 0)
×
43
    {
NEW
44
        $this->url = $url;
×
45
        $this->prefix = $prefix;
×
46
        $this->lineNumber = $lineNumber;
×
47
    }
×
48

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

57
    public function __toString(): string
×
58
    {
59
        return $this->render(new OutputFormat());
×
60
    }
61

62
    public function render(OutputFormat $outputFormat): string
×
63
    {
64
        return '@namespace ' . ($this->prefix === null ? '' : $this->prefix . ' ')
×
NEW
65
            . $this->url->render($outputFormat) . ';';
×
66
    }
67

68
    /**
69
     * @return string
70
     */
71
    public function getUrl()
×
72
    {
NEW
73
        return $this->url;
×
74
    }
75

76
    /**
77
     * @return string|null
78
     */
79
    public function getPrefix()
×
80
    {
81
        return $this->prefix;
×
82
    }
83

84
    /**
85
     * @param string $url
86
     */
NEW
87
    public function setUrl($url): void
×
88
    {
NEW
89
        $this->url = $url;
×
90
    }
×
91

92
    /**
93
     * @param string $prefix
94
     */
95
    public function setPrefix($prefix): void
×
96
    {
97
        $this->prefix = $prefix;
×
98
    }
×
99

100
    /**
101
     * @return string
102
     */
103
    public function atRuleName(): string
×
104
    {
105
        return 'namespace';
×
106
    }
107

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

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

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

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