TableChartOptions   A
last analyzed

Complexity

Total Complexity 16

Size/Duplication

Total Lines 293
Duplicated Lines 0 %

Test Coverage

Coverage 0%

Importance

Changes 3
Bugs 0 Features 0
Metric Value
eloc 48
c 3
b 0
f 0
dl 0
loc 293
ccs 0
cts 46
cp 0
rs 10
wmc 16

16 Methods

Rating   Name   Duplication   Size   Complexity  
A setPagingButtons() 0 5 1
A setSortColumn() 0 5 1
A setFirstRowNumber() 0 5 1
A setFrozenColumns() 0 5 1
A setAlternatingRowStyle() 0 5 1
A setStartPage() 0 5 1
A getCssClassNames() 0 3 1
A setSortAscending() 0 5 1
A setSort() 0 5 1
A setScrollLeftStartPosition() 0 5 1
A setRtlTable() 0 5 1
A setPageSize() 0 5 1
A setWidth() 0 5 1
A setPage() 0 5 1
A __construct() 0 3 1
A setShowRowNumber() 0 5 1
1
<?php
2
3
namespace CMEN\GoogleChartsBundle\GoogleCharts\Options\TableChart;
4
5
use CMEN\GoogleChartsBundle\GoogleCharts\Options\AllowHtmlTrait;
6
use CMEN\GoogleChartsBundle\GoogleCharts\Options\ChartOptionsInterface;
7
use CMEN\GoogleChartsBundle\GoogleCharts\Options\HeightTrait;
8
9
/**
10
 * @author Christophe Meneses
11
 */
12
class TableChartOptions implements ChartOptionsInterface
13
{
14
    use AllowHtmlTrait;
15
16
    use HeightTrait;
17
18
    /**
19
     * Determines if alternating color style will be assigned to odd and even rows.
20
     *
21
     * @var bool
22
     */
23
    protected $alternatingRowStyle;
24
25
    /**
26
     * @var CssClassNames
27
     */
28
    protected $cssClassNames;
29
30
    /**
31
     * The row number for the first row in the dataTable. Used only if showRowNumber is true.
32
     *
33
     * @var int
34
     */
35
    protected $firstRowNumber;
36
37
    /**
38
     * The number of columns from the left that will be frozen. These columns will remain in place when scrolling
39
     * the remaining columns horizontally. If showRowNumber is false, setting frozenColumns to 0 will appear the same
40
     * as if set to null, but if showRowNumber is set to true, the row number column will be frozen.
41
     *
42
     * @var int
43
     */
44
    protected $frozenColumns;
45
46
    /**
47
     *  If and how to enable paging through the data. Choose one of the following string values :
48
     *    'enable' - The table will include page-forward and page-back buttons. Clicking on these buttons will perform
49
     *     the paging operation and change the displayed page. You might want to also set the pageSize option.
50
     *    'event' - The table will include page-forward and page-back buttons, but clicking them will trigger a 'page'
51
     *     event and will not change the displayed page. This option should be used when the code implements its own
52
     *     page turning logic. See the TableQueryWrapper example for an example of how to handle paging events manually.
53
     *    'disable' - [Default] Paging is not supported.
54
     *
55
     * @var string
56
     */
57
    protected $page;
58
59
    /**
60
     * The number of rows in each page, when paging is enabled with the page option.
61
     *
62
     * @var int
63
     */
64
    protected $pageSize;
65
66
    /**
67
     * Sets a specified option for the paging buttons. The options are as follows :
68
     *    'both' - enable prev and next buttons
69
     *    'prev' - only prev button is enabled
70
     *    'next' - only next button is enabled
71
     *    'auto' - the buttons are enabled according to the current page. On the first page only next is shown.
72
     *          On the last page only prev is shown. Otherwise both are enabled.
73
     *    number - the number of paging buttons to show. This explicit number will override computed number
74
     *          from pageSize.
75
     *
76
     * @var string|int
77
     */
78
    protected $pagingButtons;
79
80
    /**
81
     * Adds basic support for right-to-left languages (such as Arabic or Hebrew) by reversing the column order of the
82
     * table, so that column zero is the rightmost column, and the last column is the leftmost column. This does not
83
     * affect the column index in the underlying data, only the order of display. Full bi-directional (BiDi) language
84
     * display is not supported by the table visualization even with this option. This option will be ignored if you
85
     * enable paging (using the page option), or if the table has scroll bars because you have specified height and
86
     * width options smaller than the required table size.
87
     *
88
     * @var bool
89
     */
90
    protected $rtlTable;
91
92
    /**
93
     * Sets the horizontal scrolling position, in pixels, if the table has horizontal scroll bars because you have
94
     * set the width property. The table will open scrolled that many pixels past the leftmost column.
95
     *
96
     * @var int
97
     */
98
    protected $scrollLeftStartPosition;
99
100
    /**
101
     * If set to true, shows the row number as the first column of the table.
102
     *
103
     * @var bool
104
     */
105
    protected $showRowNumber;
106
107
    /**
108
     * If and how to sort columns when the user clicks a column heading. If sorting is enabled, consider setting the
109
     * sortAscending and sortColumn properties as well. Choose one of the following string values :
110
     *    'enable' - [Default] Users can click on column headers to sort by the clicked column. When users click on
111
     *          the column header, the rows will be automatically sorted, and a 'sort' event will be triggered.
112
     *    'event' - When users click on the column header, a 'sort' event will be triggered, but the rows will not
113
     *          be automatically sorted. This option should be used when the page implements its own sort. See the
114
     *          TableQueryWrapper example for an example of how to handle sorting events manually.
115
     *    'disable' - Clicking a column header has no effect.
116
     *
117
     * @var string
118
     */
119
    protected $sort;
120
121
    /**
122
     * The order in which the initial sort column is sorted. True for ascending, false for descending. Ignored if
123
     * sortColumn is not specified.
124
     *
125
     * @var bool
126
     */
127
    protected $sortAscending;
128
129
    /**
130
     * An index of a column in the data table, by which the table is initially sorted. The column will be marked with
131
     * a small arrow indicating the sort order.
132
     *
133
     * @var int
134
     */
135
    protected $sortColumn;
136
137
    /**
138
     * The first table page to display. Used only if page is in mode enable/event.
139
     *
140
     * @var int
141
     */
142
    protected $startPage;
143
144
    /**
145
     * Sets the width of the visualization's container element. You can use standard HTML units (for example, '100px',
146
     * '80em', '60'). If no units are specified the number is assumed to be pixels. If not specified, the browser will
147
     * adjust the width automatically to fit the table, shrinking as much as possible in the process; if set smaller
148
     * than the width required, the table will add a horizontal scroll bar. If set to '100%', the table will expand as
149
     * much as possible into the container element.
150
     *
151
     * @var string
152
     */
153
    protected $width;
154
155
    public function __construct()
156
    {
157
        $this->cssClassNames = new CssClassNames();
158
    }
159
160
    public function getCssClassNames(): CssClassNames
161
    {
162
        return $this->cssClassNames;
163
    }
164
165
    /**
166
     * @return $this
167
     */
168
    public function setAlternatingRowStyle(bool $alternatingRowStyle)
169
    {
170
        $this->alternatingRowStyle = $alternatingRowStyle;
171
172
        return $this;
173
    }
174
175
    /**
176
     * @return $this
177
     */
178
    public function setFirstRowNumber(int $firstRowNumber)
179
    {
180
        $this->firstRowNumber = $firstRowNumber;
181
182
        return $this;
183
    }
184
185
    /**
186
     * @return $this
187
     */
188
    public function setFrozenColumns(int $frozenColumns)
189
    {
190
        $this->frozenColumns = $frozenColumns;
191
192
        return $this;
193
    }
194
195
    /**
196
     * @return $this
197
     */
198
    public function setPage(string $page)
199
    {
200
        $this->page = $page;
201
202
        return $this;
203
    }
204
205
    /**
206
     * @return $this
207
     */
208
    public function setPageSize(int $pageSize)
209
    {
210
        $this->pageSize = $pageSize;
211
212
        return $this;
213
    }
214
215
    /**
216
     * @param int|string $pagingButtons
217
     *
218
     * @return $this
219
     */
220
    public function setPagingButtons($pagingButtons)
221
    {
222
        $this->pagingButtons = $pagingButtons;
223
224
        return $this;
225
    }
226
227
    /**
228
     * @return $this
229
     */
230
    public function setRtlTable(bool $rtlTable)
231
    {
232
        $this->rtlTable = $rtlTable;
233
234
        return $this;
235
    }
236
237
    /**
238
     * @return $this
239
     */
240
    public function setScrollLeftStartPosition(int $scrollLeftStartPosition)
241
    {
242
        $this->scrollLeftStartPosition = $scrollLeftStartPosition;
243
244
        return $this;
245
    }
246
247
    /**
248
     * @return $this
249
     */
250
    public function setShowRowNumber(bool $showRowNumber)
251
    {
252
        $this->showRowNumber = $showRowNumber;
253
254
        return $this;
255
    }
256
257
    /**
258
     * @return $this
259
     */
260
    public function setSort(string $sort)
261
    {
262
        $this->sort = $sort;
263
264
        return $this;
265
    }
266
267
    /**
268
     * @return $this
269
     */
270
    public function setSortAscending(bool $sortAscending)
271
    {
272
        $this->sortAscending = $sortAscending;
273
274
        return $this;
275
    }
276
277
    /**
278
     * @return $this
279
     */
280
    public function setSortColumn(int $sortColumn)
281
    {
282
        $this->sortColumn = $sortColumn;
283
284
        return $this;
285
    }
286
287
    /**
288
     * @return $this
289
     */
290
    public function setStartPage(int $startPage)
291
    {
292
        $this->startPage = $startPage;
293
294
        return $this;
295
    }
296
297
    /**
298
     * @return $this
299
     */
300
    public function setWidth(string $width)
301
    {
302
        $this->width = $width;
303
304
        return $this;
305
    }
306
}
307