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

MyIntervals / PHP-CSS-Parser / 13321312129

14 Feb 2025 02:34AM UTC coverage: 50.527%. Remained the same
13321312129

push

github

web-flow
[CLEANUP] Avoid Hungarian notation for `component` (#917)

Part of #756

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

958 of 1896 relevant lines covered (50.53%)

11.53 hits per line

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

0.0
/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 $aComponents;
23

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

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

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

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

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

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

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

86
    public function __toString(): string
×
87
    {
88
        return $this->render(new OutputFormat());
×
89
    }
90

91
    public function render(OutputFormat $outputFormat): string
×
92
    {
93
        return $outputFormat->implode(
×
94
            $outputFormat->spaceBeforeListArgumentSeparator($this->sSeparator) . $this->sSeparator
×
95
            . $outputFormat->spaceAfterListArgumentSeparator($this->sSeparator),
×
96
            $this->aComponents
×
97
        );
98
    }
99
}
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