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

MyIntervals / PHP-CSS-Parser / 13957745027

19 Mar 2025 10:15PM UTC coverage: 51.499%. Remained the same
13957745027

Pull #1199

github

web-flow
Merge ddb9a5b22 into 357206220
Pull Request #1199: [CLEANUP] And some more annotations for non-empty strings

945 of 1835 relevant lines covered (51.5%)

6.71 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 int<0, max> $lineNumber
31
     */
32
    public function __construct(string $type, string $arguments = '', int $lineNumber = 0)
×
33
    {
34
        parent::__construct($lineNumber);
×
35
        $this->type = $type;
×
36
        $this->arguments = $arguments;
×
37
    }
×
38

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

47
    public function atRuleArgs(): string
×
48
    {
49
        return $this->arguments;
×
50
    }
51

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