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

MyIntervals / PHP-CSS-Parser / 13101877788

02 Feb 2025 07:39PM UTC coverage: 45.742%. Remained the same
13101877788

Pull #875

github

web-flow
Merge 2307bc140 into cde73cd57
Pull Request #875: [TASK] Add native type declarations to `OutputFormat`

3 of 3 new or added lines in 1 file covered. (100.0%)

811 of 1773 relevant lines covered (45.74%)

12.43 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
28
     */
29
    protected $lineNumber;
30

31
    /**
32
     * @var array<array-key, Comment>
33
     */
34
    protected $comments;
35

36
    /**
37
     * @param string $mediaQuery
38
     * @param int $lineNumber
39
     */
40
    public function __construct(URL $location, $mediaQuery, $lineNumber = 0)
×
41
    {
42
        $this->location = $location;
×
43
        $this->mediaQuery = $mediaQuery;
×
44
        $this->lineNumber = $lineNumber;
×
45
        $this->comments = [];
×
46
    }
×
47

48
    /**
49
     * @return int
50
     */
51
    public function getLineNo()
×
52
    {
53
        return $this->lineNumber;
×
54
    }
55

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

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

72
    public function __toString(): string
×
73
    {
74
        return $this->render(new OutputFormat());
×
75
    }
76

77
    public function render(OutputFormat $oOutputFormat): string
×
78
    {
79
        return $oOutputFormat->comments($this) . '@import ' . $this->location->render($oOutputFormat)
×
80
            . ($this->mediaQuery === null ? '' : ' ' . $this->mediaQuery) . ';';
×
81
    }
82

83
    public function atRuleName(): string
×
84
    {
85
        return 'import';
×
86
    }
87

88
    /**
89
     * @return array<int, URL|string>
90
     */
91
    public function atRuleArgs(): array
×
92
    {
93
        $aResult = [$this->location];
×
94
        if ($this->mediaQuery) {
×
95
            \array_push($aResult, $this->mediaQuery);
×
96
        }
97
        return $aResult;
×
98
    }
99

100
    /**
101
     * @param array<array-key, Comment> $comments
102
     */
103
    public function addComments(array $comments): void
×
104
    {
105
        $this->comments = \array_merge($this->comments, $comments);
×
106
    }
×
107

108
    /**
109
     * @return array<array-key, Comment>
110
     */
111
    public function getComments()
×
112
    {
113
        return $this->comments;
×
114
    }
115

116
    /**
117
     * @param array<array-key, Comment> $comments
118
     */
119
    public function setComments(array $comments): void
×
120
    {
121
        $this->comments = $comments;
×
122
    }
×
123

124
    /**
125
     * @return string
126
     */
127
    public function getMediaQuery()
×
128
    {
129
        return $this->mediaQuery;
×
130
    }
131
}
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