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

MyIntervals / PHP-CSS-Parser / 14071846196

25 Mar 2025 11:10PM UTC coverage: 52.82% (+0.6%) from 52.257%
14071846196

Pull #1217

github

web-flow
Merge e5f29caa1 into ee07bde2e
Pull Request #1217: [TASK] Use `CommentContainer` trait to implement `Commentable`

946 of 1791 relevant lines covered (52.82%)

7.05 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\CommentContainer;
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
    use CommentContainer;
17

18
    /**
19
     * @var URL
20
     */
21
    private $location;
22

23
    /**
24
     * @var string|null
25
     */
26
    private $mediaQuery;
27

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

35
    /**
36
     * @param int<0, max> $lineNumber
37
     */
38
    public function __construct(URL $location, ?string $mediaQuery, int $lineNumber = 0)
×
39
    {
40
        $this->location = $location;
×
41
        $this->mediaQuery = $mediaQuery;
×
42
        $this->lineNumber = $lineNumber;
×
43
    }
×
44

45
    /**
46
     * @return int<0, max>
47
     */
48
    public function getLineNo(): int
×
49
    {
50
        return $this->lineNumber;
×
51
    }
52

53
    public function setLocation(URL $location): void
×
54
    {
55
        $this->location = $location;
×
56
    }
×
57

58
    public function getLocation(): URL
×
59
    {
60
        return $this->location;
×
61
    }
62

63
    /**
64
     * @return non-empty-string
65
     */
66
    public function render(OutputFormat $outputFormat): string
×
67
    {
68
        return $outputFormat->getFormatter()->comments($this) . '@import ' . $this->location->render($outputFormat)
×
69
            . ($this->mediaQuery === null ? '' : ' ' . $this->mediaQuery) . ';';
×
70
    }
71

72
    /**
73
     * @return non-empty-string
74
     */
75
    public function atRuleName(): string
×
76
    {
77
        return 'import';
×
78
    }
79

80
    /**
81
     * @return array{0: URL, 1?: non-empty-string}
82
     */
83
    public function atRuleArgs(): array
×
84
    {
85
        $result = [$this->location];
×
86
        if (\is_string($this->mediaQuery) && $this->mediaQuery !== '') {
×
87
            $result[] = $this->mediaQuery;
×
88
        }
89

90
        return $result;
×
91
    }
92

93
    public function getMediaQuery(): ?string
×
94
    {
95
        return $this->mediaQuery;
×
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

© 2026 Coveralls, Inc