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

MyIntervals / PHP-CSS-Parser / 20772587941

07 Jan 2026 06:19AM UTC coverage: 70.316% (+1.1%) from 69.191%
20772587941

Pull #1442

github

web-flow
Merge 44fbf83d1 into 2b61cd568
Pull Request #1442: [FEATURE] Convert legacy color notation to modern css 4 notation

4 of 9 new or added lines in 2 files covered. (44.44%)

65 existing lines in 7 files now uncovered.

1400 of 1991 relevant lines covered (70.32%)

32.28 hits per line

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

48.57
/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
use Sabberworm\CSS\ShortClassNameProvider;
9

10
/**
11
 * A `ValueList` represents a lists of `Value`s, separated by some separation character
12
 * (mostly `,`, whitespace, or `/`).
13
 *
14
 * There are two types of `ValueList`s: `RuleValueList` and `CSSFunction`
15
 */
16
abstract class ValueList extends Value
17
{
18
    use ShortClassNameProvider;
19

20
    /**
21
     * @var array<Value|string>
22
     *
23
     * @internal since 8.8.0
24
     */
25
    protected $components;
26

27
    /**
28
     * @var non-empty-string
29
     *
30
     * @internal since 8.8.0
31
     */
32
    protected $separator;
33

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

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

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

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

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

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

UNCOV
89
    public function render(OutputFormat $outputFormat): string
×
90
    {
91
        $formatter = $outputFormat->getFormatter();
×
92

93
        return $formatter->implode(
×
UNCOV
94
            $formatter->spaceBeforeListArgumentSeparator($this->separator) . $this->separator
×
UNCOV
95
            . $formatter->spaceAfterListArgumentSeparator($this->separator),
×
UNCOV
96
            $this->components
×
97
        );
98
    }
99

100
    /**
101
     * @return array<string, bool|int|float|string|array<mixed>|null>
102
     *
103
     * @internal
104
     */
105
    public function getArrayRepresentation(): array
8✔
106
    {
107
        return [
108
            'class' => $this->getShortClassName(),
8✔
109
            'components' => \array_map(
8✔
110
                /**
111
                 * @parm Value|string $component
112
                 */
113
                function ($component): array {
114
                    if (\is_string($component)) {
3✔
115
                        return ['class' => 'string', 'value' => $component];
2✔
116
                    }
117
                    return $component->getArrayRepresentation();
2✔
118
                },
8✔
119
                $this->components
8✔
120
            ),
121
            'separator' => $this->separator,
8✔
122
        ];
123
    }
124
}
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

© 2026 Coveralls, Inc