1919 *
2020 * @author Fabien Potencier <[email protected] > 2121 * @author Саша Стаменковић <[email protected] > 22+ * @author Dany Maillard <[email protected] > 2223 */
2324class TableStyle
2425{
2526 private $ paddingChar = ' ' ;
2627 private $ horizontalBorderChar = '- ' ;
2728 private $ verticalBorderChar = '| ' ;
2829 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 = '+ ' ;
2938 private $ cellHeaderFormat = '<info>%s</info> ' ;
3039 private $ cellRowFormat = '%s ' ;
3140 private $ cellRowContentFormat = ' %s ' ;
@@ -117,9 +126,7 @@ public function getVerticalBorderChar()
117126 */
118127 public function setCrossingChar ($ crossingChar )
119128 {
120- $ this ->crossingChar = $ crossingChar ;
121-
122- return $ this ;
129+ return $ this ->setCrossingChars ($ crossingChar );
123130 }
124131
125132 /**
@@ -132,6 +139,127 @@ public function getCrossingChar()
132139 return $ this ->crossingChar ;
133140 }
134141
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+
135263 /**
136264 * Sets header cell format.
137265 *
0 commit comments