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

MyIntervals / PHP-CSS-Parser / 13808921310

12 Mar 2025 10:17AM UTC coverage: 55.752% (-0.03%) from 55.782%
13808921310

Pull #1149

github

web-flow
Merge 129d793ac into 46da4b251
Pull Request #1149: [CLEANUP] Avoid magic method forwarding in `ValueList`

0 of 4 new or added lines in 1 file covered. (0.0%)

1 existing line in 1 file now uncovered.

1042 of 1869 relevant lines covered (55.75%)

12.39 hits per line

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

28.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

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<array-key, Value|string>
19
     *
20
     * @internal since 8.8.0
21
     */
22
    protected $components;
23

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

31
    /**
32
     * @param array<array-key, Value|string>|Value|string $components
33
     * @param 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<array-key, Value|string>
56
     */
57
    public function getListComponents()
×
58
    {
59
        return $this->components;
×
60
    }
61

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

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

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

86
    /**
87
     * @deprecated in V8.8.0, will be removed in V9.0.0. Use `render` instead.
88
     */
89
    public function __toString(): string
×
90
    {
91
        return $this->render(new OutputFormat());
×
92
    }
93

94
    public function render(OutputFormat $outputFormat): string
×
95
    {
NEW
96
        $formatter = $outputFormat->getFormatter();
×
97

NEW
98
        return $formatter->implode(
×
NEW
99
            $formatter->spaceBeforeListArgumentSeparator($this->separator) . $this->separator
×
NEW
100
            . $formatter->spaceAfterListArgumentSeparator($this->separator),
×
UNCOV
101
            $this->components
×
102
        );
103
    }
104
}
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