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

lonnieezell / Bonfire2 / 18263264420

05 Oct 2025 07:22PM UTC coverage: 45.14% (+0.05%) from 45.094%
18263264420

Pull #577

github

web-flow
Merge 0cc3faebc into 9641e0456
Pull Request #577: Rector suggested changes on consistent string handling

4 of 6 new or added lines in 6 files covered. (66.67%)

103 existing lines in 1 file now uncovered.

1593 of 3529 relevant lines covered (45.14%)

10.65 hits per line

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

0.0
/src/Widgets/Types/Charts/ChartDataset.php
1
<?php
2

3
/**
4
 * This file is part of Bonfire.
5
 *
6
 * (c) Lonnie Ezell <lonnieje@gmail.com>
7
 *
8
 * For the full copyright and license information, please view
9
 * the LICENSE file that was distributed with this source code.
10
 */
11

12
namespace Bonfire\Widgets\Types\Charts;
13

14
class ChartDataset
15
{
16
    /**
17
     * The label for the dataset which appears in the legend and tooltips.
18
     */
19
    protected string $label;
20

21
    protected array $data;
22
    protected array $backgroundColor = [
23
        'rgba(255,  99, 132, 0.2)',
24
        'rgba(255, 159,  64, 0.2)',
25
        'rgba(255, 205,  86, 0.2)',
26
        'rgba( 75, 192, 192, 0.2)',
27
        'rgba( 54, 162, 235, 0.2)',
28
        'rgba(153, 102, 255, 0.2)',
29
        'rgba(201, 203, 207, 0.2)',
30
    ];
31
    protected array $borderColor = [
32
        'rgb(255,  99, 132)',
33
        'rgb(255, 159,  64)',
34
        'rgb(255, 205,  86)',
35
        'rgb( 75, 192, 192)',
36
        'rgb( 54, 162, 235)',
37
        'rgb(153, 102, 255)',
38
        'rgb(201, 203, 207)',
39
    ];
40
    protected int $borderWidth = 1;
41
    protected float $tension   = 0.1;
42
    protected int $hoverOffset = 20;
43

44
    public function __construct(?array $data = null)
45
    {
46
        if (! is_array($data)) {
×
47
            return;
×
48
        }
49

50
        foreach ($data as $key => $value) {
×
NEW
51
            $method = 'set' . ucfirst((string) $key);
×
52
            if (method_exists($this, $method)) {
×
53
                $this->{$method}($value);
×
54
            }
55
        }
56
    }
57

58
    /**
59
     * Get the label for the dataset which appears in the legend and tooltips.
60
     */
61
    public function label(): string
62
    {
63
        return $this->label;
×
64
    }
65

66
    public function data(): array
67
    {
68
        return $this->data;
×
69
    }
70

71
    /**
72
     * @return array|list<string>
73
     */
74
    public function backgroundColor(): array
75
    {
76
        return $this->backgroundColor;
×
77
    }
78

79
    /**
80
     * @return array|list<string>
81
     */
82
    public function borderColor(): array
83
    {
84
        return $this->borderColor;
×
85
    }
86

87
    public function borderWidth(): int
88
    {
89
        return $this->borderWidth;
×
90
    }
91

92
    public function tension(): float
93
    {
94
        return $this->tension;
×
95
    }
96

97
    public function hoverOffset(): int
98
    {
99
        return $this->hoverOffset;
×
100
    }
101

102
    /**
103
     * Set the label for the dataset which appears in the legend and tooltips.
104
     *
105
     * @param mixed $label
106
     */
107
    public function setLabel($label): ChartDataset
108
    {
109
        $this->label = $label;
×
110

111
        return $this;
×
112
    }
113

114
    /**
115
     * @param mixed $data
116
     */
117
    public function setData($data): ChartDataset
118
    {
119
        $this->data = $data;
×
120

121
        return $this;
×
122
    }
123

124
    /**
125
     * @param mixed $backgroundColor
126
     */
127
    public function setBackgroundColor($backgroundColor): ChartDataset
128
    {
129
        $this->backgroundColor = $backgroundColor;
×
130

131
        return $this;
×
132
    }
133

134
    /**
135
     * @param mixed $borderColor
136
     */
137
    public function setBorderColor($borderColor): ChartDataset
138
    {
139
        $this->borderColor = $borderColor;
×
140

141
        return $this;
×
142
    }
143

144
    /**
145
     * @param mixed $borderWidth
146
     */
147
    public function setBorderWidth($borderWidth): ChartDataset
148
    {
149
        $this->borderWidth = $borderWidth;
×
150

151
        return $this;
×
152
    }
153

154
    /**
155
     * @param mixed $tension
156
     */
157
    public function setTension($tension): ChartDataset
158
    {
159
        $this->tension = $tension;
×
160

161
        return $this;
×
162
    }
163

164
    /**
165
     * @param mixed $hoverOffset
166
     */
167
    public function setHoverOffset($hoverOffset): ChartDataset
168
    {
169
        $this->hoverOffset = $hoverOffset;
×
170

171
        return $this;
×
172
    }
173
}
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