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

MyIntervals / PHP-CSS-Parser / 13816470974

12 Mar 2025 04:25PM UTC coverage: 55.68%. Remained the same
13816470974

push

github

web-flow
[CLEANUP] Avoid magic method forwarding in `Import` (#1156)

Part of #1147

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

1044 of 1875 relevant lines covered (55.68%)

12.38 hits per line

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

0.0
/src/Property/Import.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\URL;
10

11
/**
12
 * Class representing an `@import` rule.
13
 */
14
class Import implements AtRule
15
{
16
    /**
17
     * @var URL
18
     */
19
    private $location;
20

21
    /**
22
     * @var string
23
     */
24
    private $mediaQuery;
25

26
    /**
27
     * @var int<0, max>
28
     *
29
     * @internal since 8.8.0
30
     */
31
    protected $lineNumber;
32

33
    /**
34
     * @var array<array-key, Comment>
35
     *
36
     * @internal since 8.8.0
37
     */
38
    protected $comments = [];
39

40
    /**
41
     * @param string $mediaQuery
42
     * @param int<0, max> $lineNumber
43
     */
44
    public function __construct(URL $location, $mediaQuery, int $lineNumber = 0)
×
45
    {
46
        $this->location = $location;
×
47
        $this->mediaQuery = $mediaQuery;
×
48
        $this->lineNumber = $lineNumber;
×
49
    }
×
50

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

59
    /**
60
     * @param URL $location
61
     */
62
    public function setLocation($location): void
×
63
    {
64
        $this->location = $location;
×
65
    }
×
66

67
    /**
68
     * @return URL
69
     */
70
    public function getLocation()
×
71
    {
72
        return $this->location;
×
73
    }
74

75
    /**
76
     * @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
77
     */
78
    public function __toString(): string
×
79
    {
80
        return $this->render(new OutputFormat());
×
81
    }
82

83
    public function render(OutputFormat $outputFormat): string
×
84
    {
NEW
85
        return $outputFormat->getFormatter()->comments($this) . '@import ' . $this->location->render($outputFormat)
×
86
            . ($this->mediaQuery === null ? '' : ' ' . $this->mediaQuery) . ';';
×
87
    }
88

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

97
    /**
98
     * @return array<int, URL|string>
99
     */
100
    public function atRuleArgs(): array
×
101
    {
102
        $result = [$this->location];
×
103
        if ($this->mediaQuery) {
×
104
            \array_push($result, $this->mediaQuery);
×
105
        }
106
        return $result;
×
107
    }
108

109
    /**
110
     * @param array<array-key, Comment> $comments
111
     */
112
    public function addComments(array $comments): void
×
113
    {
114
        $this->comments = \array_merge($this->comments, $comments);
×
115
    }
×
116

117
    /**
118
     * @return array<array-key, Comment>
119
     */
120
    public function getComments(): array
×
121
    {
122
        return $this->comments;
×
123
    }
124

125
    /**
126
     * @param array<array-key, Comment> $comments
127
     */
128
    public function setComments(array $comments): void
×
129
    {
130
        $this->comments = $comments;
×
131
    }
×
132

133
    /**
134
     * @return string
135
     */
136
    public function getMediaQuery()
×
137
    {
138
        return $this->mediaQuery;
×
139
    }
140
}
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