• 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

0.0
/src/RuleSet/AtRuleSet.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Sabberworm\CSS\RuleSet;
6

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

10
/**
11
 * This class represents rule sets for generic at-rules which are not covered by specific classes, i.e., not
12
 * `@import`, `@charset` or `@media`.
13
 *
14
 * A common example for this is `@font-face`.
15
 */
16
class AtRuleSet extends RuleSet implements AtRule
17
{
18
    /**
19
     * @var non-empty-string
20
     */
21
    private $type;
22

23
    /**
24
     * @var string
25
     */
26
    private $arguments;
27

28
    /**
29
     * @param non-empty-string $type
30
     * @param string $arguments
31
     * @param int<0, max> $lineNumber
32
     */
33
    public function __construct($type, $arguments = '', int $lineNumber = 0)
×
34
    {
35
        parent::__construct($lineNumber);
×
36
        $this->type = $type;
×
37
        $this->arguments = $arguments;
×
38
    }
×
39

40
    /**
41
     * @return non-empty-string
42
     */
43
    public function atRuleName(): string
×
44
    {
45
        return $this->type;
×
46
    }
47

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

56
    public function render(OutputFormat $outputFormat): string
×
57
    {
58
        $formatter = $outputFormat->getFormatter();
×
59
        $result = $formatter->comments($this);
×
60
        $arguments = $this->arguments;
×
61
        if ($arguments) {
×
62
            $arguments = ' ' . $arguments;
×
63
        }
64
        $result .= "@{$this->type}$arguments{$formatter->spaceBeforeOpeningBrace()}{";
×
65
        $result .= $this->renderRules($outputFormat);
×
66
        $result .= '}';
×
67
        return $result;
×
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