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

MyIntervals / PHP-CSS-Parser / 13955519945

19 Mar 2025 07:54PM UTC coverage: 51.499%. Remained the same
13955519945

Pull #1197

github

web-flow
Merge 0b6cca91e into 45cd62ff0
Pull Request #1197: [TASK] Add native type declarations for `CSSFunction`

0 of 5 new or added lines in 2 files covered. (0.0%)

1 existing line in 1 file now uncovered.

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

30.77
/src/Value/ValueList.php
1
<?php
2

3
declare(strict_types=1);
4

5
namespace Sabberworm\CSS\Value;
6

7
use Sabberworm\CSS\OutputFormat;
8

9
/**
10
 * A `ValueList` represents a lists of `Value`s, separated by some separation character
11
 * (mostly `,`, whitespace, or `/`).
12
 *
13
 * There are two types of `ValueList`s: `RuleValueList` and `CSSFunction`
14
 */
15
abstract class ValueList extends Value
16
{
17
    /**
18
     * @var array<Value|string>
19
     *
20
     * @internal since 8.8.0
21
     */
22
    protected $components;
23

24
    /**
25
     * @var non-empty-string
26
     *
27
     * @internal since 8.8.0
28
     */
29
    protected $separator;
30

31
    /**
32
     * @param array<Value|string>|Value|string $components
33
     * @param non-empty-string $separator
34
     * @param int<0, max> $lineNumber
35
     */
36
    public function __construct($components = [], $separator = ',', int $lineNumber = 0)
4✔
37
    {
38
        parent::__construct($lineNumber);
4✔
39
        if (!\is_array($components)) {
4✔
40
            $components = [$components];
×
41
        }
42
        $this->components = $components;
4✔
43
        $this->separator = $separator;
4✔
44
    }
4✔
45

46
    /**
47
     * @param Value|string $component
48
     */
49
    public function addListComponent($component): void
×
50
    {
51
        $this->components[] = $component;
×
52
    }
×
53

54
    /**
55
     * @return array<Value|string>
56
     */
57
    public function getListComponents(): array
×
58
    {
59
        return $this->components;
×
60
    }
61

62
    /**
63
     * @param array<Value|string> $components
64
     */
65
    public function setListComponents(array $components): void
×
66
    {
67
        $this->components = $components;
×
68
    }
×
69

70
    /**
71
     * @return non-empty-string
72
     */
73
    public function getListSeparator(): string
1✔
74
    {
75
        return $this->separator;
1✔
76
    }
77

78
    /**
79
     * @param non-empty-string $separator
80
     */
UNCOV
81
    public function setListSeparator(string $separator): void
×
82
    {
83
        $this->separator = $separator;
×
84
    }
×
85

86
    public function render(OutputFormat $outputFormat): string
×
87
    {
88
        $formatter = $outputFormat->getFormatter();
×
89

90
        return $formatter->implode(
×
91
            $formatter->spaceBeforeListArgumentSeparator($this->separator) . $this->separator
×
92
            . $formatter->spaceAfterListArgumentSeparator($this->separator),
×
93
            $this->components
×
94
        );
95
    }
96
}
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