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

MyIntervals / PHP-CSS-Parser / 16176944918

09 Jul 2025 06:11PM UTC coverage: 57.958% (+0.02%) from 57.935%
16176944918

Pull #1321

github

web-flow
Merge 2024d46ac into 6dec68e38
Pull Request #1321: [CLEANUP] Use static variable for stop characters

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

1056 of 1822 relevant lines covered (57.96%)

16.66 hits per line

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

22.73
/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\Position\Position;
10
use Sabberworm\CSS\Position\Positionable;
11
use Sabberworm\CSS\Value\URL;
12

13
/**
14
 * Class representing an `@import` rule.
15
 */
16
class Import implements AtRule, Positionable
17
{
18
    use CommentContainer;
19
    use Position;
20

21
    /**
22
     * @var URL
23
     */
24
    private $location;
25

26
    /**
27
     * @var string|null
28
     */
29
    private $mediaQuery;
30

31
    /**
32
     * @param int<1, max>|null $lineNumber
33
     */
34
    public function __construct(URL $location, ?string $mediaQuery, ?int $lineNumber = null)
1✔
35
    {
36
        $this->location = $location;
1✔
37
        $this->mediaQuery = $mediaQuery;
1✔
38
        $this->setPosition($lineNumber);
1✔
39
    }
1✔
40

41
    public function setLocation(URL $location): void
×
42
    {
43
        $this->location = $location;
×
44
    }
×
45

46
    public function getLocation(): URL
×
47
    {
48
        return $this->location;
×
49
    }
50

51
    /**
52
     * @return non-empty-string
53
     */
54
    public function render(OutputFormat $outputFormat): string
×
55
    {
56
        return $outputFormat->getFormatter()->comments($this) . '@import ' . $this->location->render($outputFormat)
×
57
            . ($this->mediaQuery === null ? '' : ' ' . $this->mediaQuery) . ';';
×
58
    }
59

60
    /**
61
     * @return non-empty-string
62
     */
63
    public function atRuleName(): string
×
64
    {
65
        return 'import';
×
66
    }
67

68
    /**
69
     * @return array{0: URL, 1?: non-empty-string}
70
     */
71
    public function atRuleArgs(): array
×
72
    {
73
        $result = [$this->location];
×
74
        if (\is_string($this->mediaQuery) && $this->mediaQuery !== '') {
×
75
            $result[] = $this->mediaQuery;
×
76
        }
77

78
        return $result;
×
79
    }
80

81
    public function getMediaQuery(): ?string
×
82
    {
83
        return $this->mediaQuery;
×
84
    }
85
}
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