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

MyIntervals / PHP-CSS-Parser / 13270679659

11 Feb 2025 07:12PM UTC coverage: 49.156%. Remained the same
13270679659

Pull #910

github

web-flow
Merge c5f9fd700 into a5d22be77
Pull Request #910: [CLEANUP] Avoid Hungarian notation for `outputFormat`

22 of 58 new or added lines in 18 files covered. (37.93%)

1 existing line in 1 file now uncovered.

932 of 1896 relevant lines covered (49.16%)

11.42 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<0, max> $lineNumber
41
     */
42
    public function __construct($mUrl, $sPrefix = null, $lineNumber = 0)
×
43
    {
44
        $this->mUrl = $mUrl;
×
45
        $this->sPrefix = $sPrefix;
×
46
        $this->lineNumber = $lineNumber;
×
47
        $this->comments = [];
×
48
    }
×
49

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

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

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

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

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

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

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

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

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

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

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

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