Failed Conditions
Pull Request — master (#4412)
by
unknown
22:45 queued 07:48
created

TableStyle::getShowLastColumn()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace PhpOffice\PhpSpreadsheet\Worksheet\Table;
4
5
use PhpOffice\PhpSpreadsheet\Worksheet\Table;
6
7
class TableStyle
8
{
9
    const TABLE_STYLE_NONE = '';
10
    const TABLE_STYLE_LIGHT1 = 'TableStyleLight1';
11
    const TABLE_STYLE_LIGHT2 = 'TableStyleLight2';
12
    const TABLE_STYLE_LIGHT3 = 'TableStyleLight3';
13
    const TABLE_STYLE_LIGHT4 = 'TableStyleLight4';
14
    const TABLE_STYLE_LIGHT5 = 'TableStyleLight5';
15
    const TABLE_STYLE_LIGHT6 = 'TableStyleLight6';
16
    const TABLE_STYLE_LIGHT7 = 'TableStyleLight7';
17
    const TABLE_STYLE_LIGHT8 = 'TableStyleLight8';
18
    const TABLE_STYLE_LIGHT9 = 'TableStyleLight9';
19
    const TABLE_STYLE_LIGHT10 = 'TableStyleLight10';
20
    const TABLE_STYLE_LIGHT11 = 'TableStyleLight11';
21
    const TABLE_STYLE_LIGHT12 = 'TableStyleLight12';
22
    const TABLE_STYLE_LIGHT13 = 'TableStyleLight13';
23
    const TABLE_STYLE_LIGHT14 = 'TableStyleLight14';
24
    const TABLE_STYLE_LIGHT15 = 'TableStyleLight15';
25
    const TABLE_STYLE_LIGHT16 = 'TableStyleLight16';
26
    const TABLE_STYLE_LIGHT17 = 'TableStyleLight17';
27
    const TABLE_STYLE_LIGHT18 = 'TableStyleLight18';
28
    const TABLE_STYLE_LIGHT19 = 'TableStyleLight19';
29
    const TABLE_STYLE_LIGHT20 = 'TableStyleLight20';
30
    const TABLE_STYLE_LIGHT21 = 'TableStyleLight21';
31
    const TABLE_STYLE_MEDIUM1 = 'TableStyleMedium1';
32
    const TABLE_STYLE_MEDIUM2 = 'TableStyleMedium2';
33
    const TABLE_STYLE_MEDIUM3 = 'TableStyleMedium3';
34
    const TABLE_STYLE_MEDIUM4 = 'TableStyleMedium4';
35
    const TABLE_STYLE_MEDIUM5 = 'TableStyleMedium5';
36
    const TABLE_STYLE_MEDIUM6 = 'TableStyleMedium6';
37
    const TABLE_STYLE_MEDIUM7 = 'TableStyleMedium7';
38
    const TABLE_STYLE_MEDIUM8 = 'TableStyleMedium8';
39
    const TABLE_STYLE_MEDIUM9 = 'TableStyleMedium9';
40
    const TABLE_STYLE_MEDIUM10 = 'TableStyleMedium10';
41
    const TABLE_STYLE_MEDIUM11 = 'TableStyleMedium11';
42
    const TABLE_STYLE_MEDIUM12 = 'TableStyleMedium12';
43
    const TABLE_STYLE_MEDIUM13 = 'TableStyleMedium13';
44
    const TABLE_STYLE_MEDIUM14 = 'TableStyleMedium14';
45
    const TABLE_STYLE_MEDIUM15 = 'TableStyleMedium15';
46
    const TABLE_STYLE_MEDIUM16 = 'TableStyleMedium16';
47
    const TABLE_STYLE_MEDIUM17 = 'TableStyleMedium17';
48
    const TABLE_STYLE_MEDIUM18 = 'TableStyleMedium18';
49
    const TABLE_STYLE_MEDIUM19 = 'TableStyleMedium19';
50
    const TABLE_STYLE_MEDIUM20 = 'TableStyleMedium20';
51
    const TABLE_STYLE_MEDIUM21 = 'TableStyleMedium21';
52
    const TABLE_STYLE_MEDIUM22 = 'TableStyleMedium22';
53
    const TABLE_STYLE_MEDIUM23 = 'TableStyleMedium23';
54
    const TABLE_STYLE_MEDIUM24 = 'TableStyleMedium24';
55
    const TABLE_STYLE_MEDIUM25 = 'TableStyleMedium25';
56
    const TABLE_STYLE_MEDIUM26 = 'TableStyleMedium26';
57
    const TABLE_STYLE_MEDIUM27 = 'TableStyleMedium27';
58
    const TABLE_STYLE_MEDIUM28 = 'TableStyleMedium28';
59
    const TABLE_STYLE_DARK1 = 'TableStyleDark1';
60
    const TABLE_STYLE_DARK2 = 'TableStyleDark2';
61
    const TABLE_STYLE_DARK3 = 'TableStyleDark3';
62
    const TABLE_STYLE_DARK4 = 'TableStyleDark4';
63
    const TABLE_STYLE_DARK5 = 'TableStyleDark5';
64
    const TABLE_STYLE_DARK6 = 'TableStyleDark6';
65
    const TABLE_STYLE_DARK7 = 'TableStyleDark7';
66
    const TABLE_STYLE_DARK8 = 'TableStyleDark8';
67
    const TABLE_STYLE_DARK9 = 'TableStyleDark9';
68
    const TABLE_STYLE_DARK10 = 'TableStyleDark10';
69
    const TABLE_STYLE_DARK11 = 'TableStyleDark11';
70
71
    /**
72
     * Theme.
73
     */
74
    private string $theme;
75
76
    /**
77
     * Show First Column.
78
     */
79
    private bool $showFirstColumn = false;
80
81
    /**
82
     * Show Last Column.
83
     */
84
    private bool $showLastColumn = false;
85
86
    /**
87
     * Show Row Stripes.
88
     */
89
    private bool $showRowStripes = false;
90
91
    /**
92
     * Show Column Stripes.
93
     */
94
    private bool $showColumnStripes = false;
95
96
    /**
97
     * TableDxfsStyle.
98
     */
99
    private ?TableDxfsStyle $tableStyle = null;
100
101
    /**
102
     * Table.
103
     */
104
    private ?Table $table = null;
105
106
    /**
107
     * Create a new Table Style.
108
     *
109
     * @param string $theme (e.g. TableStyle::TABLE_STYLE_MEDIUM2)
110
     */
111 154
    public function __construct(string $theme = self::TABLE_STYLE_MEDIUM2)
112
    {
113 154
        $this->theme = $theme;
114
    }
115
116
    /**
117
     * Get theme.
118
     */
119 10
    public function getTheme(): string
120
    {
121 10
        return $this->theme;
122
    }
123
124
    /**
125
     * Set theme.
126
     */
127 36
    public function setTheme(string $theme): self
128
    {
129 36
        $this->theme = $theme;
130
131 36
        return $this;
132
    }
133
134
    /**
135
     * Get show First Column.
136
     */
137 10
    public function getShowFirstColumn(): bool
138
    {
139 10
        return $this->showFirstColumn;
140
    }
141
142
    /**
143
     * Set show First Column.
144
     */
145 33
    public function setShowFirstColumn(bool $showFirstColumn): self
146
    {
147 33
        $this->showFirstColumn = $showFirstColumn;
148
149 33
        return $this;
150
    }
151
152
    /**
153
     * Get show Last Column.
154
     */
155 10
    public function getShowLastColumn(): bool
156
    {
157 10
        return $this->showLastColumn;
158
    }
159
160
    /**
161
     * Set show Last Column.
162
     */
163 33
    public function setShowLastColumn(bool $showLastColumn): self
164
    {
165 33
        $this->showLastColumn = $showLastColumn;
166
167 33
        return $this;
168
    }
169
170
    /**
171
     * Get show Row Stripes.
172
     */
173 10
    public function getShowRowStripes(): bool
174
    {
175 10
        return $this->showRowStripes;
176
    }
177
178
    /**
179
     * Set show Row Stripes.
180
     */
181 33
    public function setShowRowStripes(bool $showRowStripes): self
182
    {
183 33
        $this->showRowStripes = $showRowStripes;
184
185 33
        return $this;
186
    }
187
188
    /**
189
     * Get show Column Stripes.
190
     */
191 10
    public function getShowColumnStripes(): bool
192
    {
193 10
        return $this->showColumnStripes;
194
    }
195
196
    /**
197
     * Set show Column Stripes.
198
     */
199 33
    public function setShowColumnStripes(bool $showColumnStripes): self
200
    {
201 33
        $this->showColumnStripes = $showColumnStripes;
202
203 33
        return $this;
204
    }
205
206
    /**
207
     * Get this Style's Dxfs TableStyle.
208
     */
209 2
    public function getTableDxfsStyle(): ?TableDxfsStyle
210
    {
211 2
        return $this->tableStyle;
212
    }
213
214
    /**
215
     * Set this Style's Dxfs TableStyle.
216
     */
217 4
    public function setTableDxfsStyle(TableDxfsStyle $tableStyle, array $dxfs): self
218
    {
219 4
        $this->tableStyle = $tableStyle;
220
221 4
        if ($this->tableStyle->getHeaderRow() !== null && isset($dxfs[$this->tableStyle->getHeaderRow()])) {
222 3
            $this->tableStyle->setHeaderRowStyle($dxfs[$this->tableStyle->getHeaderRow()]);
223
        }
224 4
        if ($this->tableStyle->getFirstRowStripe() !== null && isset($dxfs[$this->tableStyle->getFirstRowStripe()])) {
225 4
            $this->tableStyle->setFirstRowStripeStyle($dxfs[$this->tableStyle->getFirstRowStripe()]);
226
        }
227 4
        if ($this->tableStyle->getSecondRowStripe() !== null && isset($dxfs[$this->tableStyle->getSecondRowStripe()])) {
228 4
            $this->tableStyle->setSecondRowStripeStyle($dxfs[$this->tableStyle->getSecondRowStripe()]);
229
        }
230
231 4
        return $this;
232
    }
233
234
    /**
235
     * Get this Style's Table.
236
     */
237 1
    public function getTable(): ?Table
238
    {
239 1
        return $this->table;
240
    }
241
242
    /**
243
     * Set this Style's Table.
244
     */
245 1
    public function setTable(?Table $table = null): self
246
    {
247 1
        $this->table = $table;
248
249 1
        return $this;
250
    }
251
}
252