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

MyIntervals / PHP-CSS-Parser / 20646901208

01 Jan 2026 10:46PM UTC coverage: 69.512% (-0.5%) from 69.969%
20646901208

Pull #1441

github

web-flow
Merge 5ca221a56 into 6604f352d
Pull Request #1441: [TASK] Add `getArrayRepresentation` method for testing

13 of 22 new or added lines in 7 files covered. (59.09%)

6 existing lines in 1 file now uncovered.

1368 of 1968 relevant lines covered (69.51%)

32.5 hits per line

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

22.86
/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<1, max>|null $lineNumber
35
     */
36
    public function __construct($components = [], $separator = ',', ?int $lineNumber = null)
5✔
37
    {
38
        parent::__construct($lineNumber);
5✔
39
        if (!\is_array($components)) {
5✔
40
            $components = [$components];
×
41
        }
42
        $this->components = $components;
5✔
43
        $this->separator = $separator;
5✔
44
    }
5✔
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
     */
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

97
    /**
98
     * @internal
99
     *
100
     * @return array<string, bool|int|float|string|list<array<string, mixed>>>
101
     */
NEW
102
    public function getArrayRepresentation(): array
×
103
    {
NEW
104
        $result = parent::getArrayRepresentation();
×
105

NEW
106
        $result['components'] = \array_map(
×
107
            /**
108
             * @parm Value|string $component
109
             *
110
             * @return array|string
111
             */
112
            function ($component) {
NEW
113
                if (\is_string($component)) {
×
NEW
114
                    return $component;
×
115
                }
NEW
116
                return $component->getArrayRepresentation();
×
NEW
117
            },
×
NEW
118
            $this->components
×
119
        );
120

NEW
121
        return $result;
×
122
    }
123
}
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