19
19
*
20
20
* @author Fabien Potencier <[email protected] >
21
21
* @author Саша Стаменковић <[email protected] >
22
+ * @author Dany Maillard <[email protected] >
22
23
*/
23
24
class TableStyle
24
25
{
25
26
private $ paddingChar = ' ' ;
26
27
private $ horizontalBorderChar = '- ' ;
27
28
private $ verticalBorderChar = '| ' ;
28
29
private $ crossingChar = '+ ' ;
30
+ private $ crossingTopRightChar = '+ ' ;
31
+ private $ crossingTopMidChar = '+ ' ;
32
+ private $ crossingTopLeftChar = '+ ' ;
33
+ private $ crossingMidRightChar = '+ ' ;
34
+ private $ crossingBottomRightChar = '+ ' ;
35
+ private $ crossingBottomMidChar = '+ ' ;
36
+ private $ crossingBottomLeftChar = '+ ' ;
37
+ private $ crossingMidLeftChar = '+ ' ;
29
38
private $ cellHeaderFormat = '<info>%s</info> ' ;
30
39
private $ cellRowFormat = '%s ' ;
31
40
private $ cellRowContentFormat = ' %s ' ;
@@ -117,9 +126,7 @@ public function getVerticalBorderChar()
117
126
*/
118
127
public function setCrossingChar ($ crossingChar )
119
128
{
120
- $ this ->crossingChar = $ crossingChar ;
121
-
122
- return $ this ;
129
+ return $ this ->setCrossingChars ($ crossingChar );
123
130
}
124
131
125
132
/**
@@ -132,6 +139,127 @@ public function getCrossingChar()
132
139
return $ this ->crossingChar ;
133
140
}
134
141
142
+ /**
143
+ * Sets crossing characters.
144
+ *
145
+ * Example:
146
+ * <code>
147
+ * 1---------------2-----------------------2------------------3
148
+ * | ISBN | Title | Author |
149
+ * 8---------------0-----------------------0------------------4
150
+ * | 99921-58-10-7 | Divine Comedy | Dante Alighieri |
151
+ * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens |
152
+ * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien |
153
+ * 7---------------6-----------------------6------------------5
154
+ * </code>
155
+ *
156
+ * @param string $cross Crossing char (see #0 of example)
157
+ * @param string|null $topLeft Top left char (see #1 of example), equal to $cross if null
158
+ * @param string|null $topMid Top mid char (see #2 of example), equal to $cross if null
159
+ * @param string|null $topRight Top right char (see #3 of example), equal to $cross if null
160
+ * @param string|null $midRight Mid right char (see #4 of example), equal to $cross if null
161
+ * @param string|null $bottomRight Bottom right char (see #5 of example), equal to $cross if null
162
+ * @param string|null $bottomMid Bottom mid char (see #6 of example), equal to $cross if null
163
+ * @param string|null $bottomLeft Bottom left char (see #7 of example), equal to $cross if null
164
+ * @param string|null $midLeft Mid left char (see #8 of example), equal to $cross if null
165
+ *
166
+ * @return $this
167
+ */
168
+ public function setCrossingChars (string $ cross , string $ topLeft = null , string $ topMid = null , string $ topRight = null , string $ midRight = null , string $ bottomRight = null , string $ bottomMid = null , string $ bottomLeft = null , string $ midLeft = null ): self
169
+ {
170
+ $ this ->crossingChar = $ cross ;
171
+ $ this ->crossingTopLeftChar = $ topLeft ?? $ cross ;
172
+ $ this ->crossingTopMidChar = $ topMid ?? $ cross ;
173
+ $ this ->crossingTopRightChar = $ topRight ?? $ cross ;
174
+ $ this ->crossingMidRightChar = $ midRight ?? $ cross ;
175
+ $ this ->crossingBottomRightChar = $ bottomRight ?? $ cross ;
176
+ $ this ->crossingBottomMidChar = $ bottomMid ?? $ cross ;
177
+ $ this ->crossingBottomLeftChar = $ bottomLeft ?? $ cross ;
178
+ $ this ->crossingMidLeftChar = $ midLeft ?? $ cross ;
179
+
180
+ return $ this ;
181
+ }
182
+
183
+ /**
184
+ * Gets crossing top right char.
185
+ *
186
+ * @return string $crossingTopRightChar
187
+ */
188
+ public function getCrossingTopRightChar (): string
189
+ {
190
+ return $ this ->crossingTopRightChar ;
191
+ }
192
+
193
+ /**
194
+ * Gets crossing top mid char.
195
+ *
196
+ * @return string $crossingTopMidChar
197
+ */
198
+ public function getCrossingTopMidChar (): string
199
+ {
200
+ return $ this ->crossingTopMidChar ;
201
+ }
202
+
203
+ /**
204
+ * Gets crossing top left char.
205
+ *
206
+ * @return string $crossingTopLeftChar
207
+ */
208
+ public function getCrossingTopLeftChar (): string
209
+ {
210
+ return $ this ->crossingTopLeftChar ;
211
+ }
212
+
213
+ /**
214
+ * Gets crossing mid right char.
215
+ *
216
+ * @return string $crossingMidRightChar
217
+ */
218
+ public function getCrossingMidRightChar (): string
219
+ {
220
+ return $ this ->crossingMidRightChar ;
221
+ }
222
+
223
+ /**
224
+ * Gets crossing bottom right char.
225
+ *
226
+ * @return string $crossingBottomRightChar
227
+ */
228
+ public function getCrossingBottomRightChar (): string
229
+ {
230
+ return $ this ->crossingBottomRightChar ;
231
+ }
232
+
233
+ /**
234
+ * Gets crossing bottom mid char.
235
+ *
236
+ * @return string $crossingBottomMidChar
237
+ */
238
+ public function getCrossingBottomMidChar (): string
239
+ {
240
+ return $ this ->crossingBottomMidChar ;
241
+ }
242
+
243
+ /**
244
+ * Gets crossing bottom left char.
245
+ *
246
+ * @return string $crossingBottomLeftChar
247
+ */
248
+ public function getCrossingBottomLeftChar (): string
249
+ {
250
+ return $ this ->crossingBottomLeftChar ;
251
+ }
252
+
253
+ /**
254
+ * Gets crossing mid left char.
255
+ *
256
+ * @return string $crossingMidLeftChar
257
+ */
258
+ public function getCrossingMidLeftChar (): string
259
+ {
260
+ return $ this ->crossingMidLeftChar ;
261
+ }
262
+
135
263
/**
136
264
* Sets header cell format.
137
265
*
0 commit comments