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

MyIntervals / PHP-CSS-Parser / 13663947131

04 Mar 2025 10:12PM UTC coverage: 55.726%. Remained the same
13663947131

push

github

web-flow
[CLEANUP] Avoid Hungarian notation for `separator` (#1078)

Part of #756

9 of 16 new or added lines in 4 files covered. (56.25%)

1 existing line in 1 file now uncovered.

1056 of 1895 relevant lines covered (55.73%)

12.2 hits per line

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

29.63
/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 = ',', $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
     */
NEW
81
    public function setListSeparator($separator): void
×
82
    {
NEW
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
    {
96
        return $outputFormat->implode(
×
NEW
97
            $outputFormat->spaceBeforeListArgumentSeparator($this->separator) . $this->separator
×
NEW
98
            . $outputFormat->spaceAfterListArgumentSeparator($this->separator),
×
UNCOV
99
            $this->components
×
100
        );
101
    }
102
}
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