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

MyIntervals / PHP-CSS-Parser / 13888689221

17 Mar 2025 12:01AM UTC coverage: 56.87% (+0.9%) from 55.929%
13888689221

push

github

web-flow
[TASK] Remove `__toString()` (#1046)

Closes #998

1043 of 1834 relevant lines covered (56.87%)

12.89 hits per line

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

47.83
/src/CSSList/AtRuleBlockList.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Sabberworm\CSS\CSSList;
6

7
use Sabberworm\CSS\OutputFormat;
8
use Sabberworm\CSS\Property\AtRule;
9

10
/**
11
 * A `BlockList` constructed by an unknown at-rule. `@media` rules are rendered into `AtRuleBlockList` objects.
12
 */
13
class AtRuleBlockList extends CSSBlockList implements AtRule
14
{
15
    /**
16
     * @var non-empty-string
17
     */
18
    private $type;
19

20
    /**
21
     * @var string
22
     */
23
    private $arguments;
24

25
    /**
26
     * @param non-empty-string $type
27
     * @param int<0, max> $lineNumber
28
     */
29
    public function __construct(string $type, string $arguments = '', int $lineNumber = 0)
18✔
30
    {
31
        parent::__construct($lineNumber);
18✔
32
        $this->type = $type;
18✔
33
        $this->arguments = $arguments;
18✔
34
    }
18✔
35

36
    /**
37
     * @return non-empty-string
38
     */
39
    public function atRuleName(): string
3✔
40
    {
41
        return $this->type;
3✔
42
    }
43

44
    public function atRuleArgs(): string
4✔
45
    {
46
        return $this->arguments;
4✔
47
    }
48

49
    public function render(OutputFormat $outputFormat): string
×
50
    {
51
        $formatter = $outputFormat->getFormatter();
×
52
        $result = $formatter->comments($this);
×
53
        $result .= $outputFormat->getContentBeforeAtRuleBlock();
×
54
        $arguments = $this->arguments;
×
55
        if ($arguments) {
×
56
            $arguments = ' ' . $arguments;
×
57
        }
58
        $result .= "@{$this->type}$arguments{$formatter->spaceBeforeOpeningBrace()}{";
×
59
        $result .= $this->renderListContents($outputFormat);
×
60
        $result .= '}';
×
61
        $result .= $outputFormat->getContentAfterAtRuleBlock();
×
62
        return $result;
×
63
    }
64

65
    public function isRootList(): bool
1✔
66
    {
67
        return false;
1✔
68
    }
69
}
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