PluginProbe ʕ •ᴥ•ʔ
Matomo Analytics – Powerful, Privacy-First Insights for WordPress / 5.8.2
Matomo Analytics – Powerful, Privacy-First Insights for WordPress v5.8.2
5.11.1 5.11.0 5.10.2 5.10.1 trunk 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.3.0 1.3.1 1.3.2 4.0.0 4.0.1 4.0.2 4.0.3 4.0.4 4.1.0 4.1.1 4.1.2 4.1.3 4.10.0 4.11.0 4.12.0 4.13.0 4.13.2 4.13.3 4.13.4 4.13.5 4.14.0 4.14.1 4.14.2 4.15.0 4.15.1 4.15.2 4.15.3 4.2.0 4.3.0 4.3.1 4.4.1 4.4.2 4.5.0 4.6.0 5.0.1 5.0.2 5.0.3 5.0.4 5.0.5 5.0.6 5.0.7 5.0.8 5.1.0 5.1.1 5.1.2 5.1.3 5.1.4 5.1.5 5.1.6 5.1.7 5.10.0 5.2.0 5.2.1 5.2.2 5.3.0 5.3.1 5.3.2 5.3.3 5.6.0 5.6.1 5.7.0 5.7.1 5.8.0 5.8.1 5.8.2
matomo / app / vendor / prefixed / symfony / console / Helper / TableStyle.php
matomo / app / vendor / prefixed / symfony / console / Helper Last commit date
DebugFormatterHelper.php 1 year ago DescriptorHelper.php 1 year ago Dumper.php 1 year ago FormatterHelper.php 1 year ago Helper.php 1 year ago HelperInterface.php 2 years ago HelperSet.php 2 years ago InputAwareHelper.php 2 years ago ProcessHelper.php 2 years ago ProgressBar.php 1 year ago ProgressIndicator.php 1 year ago QuestionHelper.php 1 year ago SymfonyQuestionHelper.php 1 year ago Table.php 1 year ago TableCell.php 2 years ago TableCellStyle.php 2 years ago TableRows.php 2 years ago TableSeparator.php 2 years ago TableStyle.php 1 year ago
TableStyle.php
321 lines
1 <?php
2
3 /*
4 * This file is part of the Symfony package.
5 *
6 * (c) Fabien Potencier <fabien@symfony.com>
7 *
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
10 */
11 namespace Matomo\Dependencies\Symfony\Component\Console\Helper;
12
13 use Matomo\Dependencies\Symfony\Component\Console\Exception\InvalidArgumentException;
14 use Matomo\Dependencies\Symfony\Component\Console\Exception\LogicException;
15 /**
16 * Defines the styles for a Table.
17 *
18 * @author Fabien Potencier <fabien@symfony.com>
19 * @author Саша Стаменковић <umpirsky@gmail.com>
20 * @author Dany Maillard <danymaillard93b@gmail.com>
21 */
22 class TableStyle
23 {
24 private $paddingChar = ' ';
25 private $horizontalOutsideBorderChar = '-';
26 private $horizontalInsideBorderChar = '-';
27 private $verticalOutsideBorderChar = '|';
28 private $verticalInsideBorderChar = '|';
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 = '+';
38 private $crossingTopLeftBottomChar = '+';
39 private $crossingTopMidBottomChar = '+';
40 private $crossingTopRightBottomChar = '+';
41 private $headerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
42 private $footerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
43 private $cellHeaderFormat = '<info>%s</info>';
44 private $cellRowFormat = '%s';
45 private $cellRowContentFormat = ' %s ';
46 private $borderFormat = '%s';
47 private $padType = \STR_PAD_RIGHT;
48 /**
49 * Sets padding character, used for cell padding.
50 *
51 * @return $this
52 */
53 public function setPaddingChar(string $paddingChar)
54 {
55 if (!$paddingChar) {
56 throw new LogicException('The padding char must not be empty.');
57 }
58 $this->paddingChar = $paddingChar;
59 return $this;
60 }
61 /**
62 * Gets padding character, used for cell padding.
63 *
64 * @return string
65 */
66 public function getPaddingChar()
67 {
68 return $this->paddingChar;
69 }
70 /**
71 * Sets horizontal border characters.
72 *
73 * <code>
74 * ╔═══════════════╤══════════════════════════╤══════════════════╗
75 * 1 ISBN 2 Title │ Author ║
76 * ╠═══════════════╪══════════════════════════╪══════════════════╣
77 * ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
78 * ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
79 * ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
80 * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
81 * ╚═══════════════╧══════════════════════════╧══════════════════╝
82 * </code>
83 *
84 * @return $this
85 */
86 public function setHorizontalBorderChars(string $outside, ?string $inside = null) : self
87 {
88 $this->horizontalOutsideBorderChar = $outside;
89 $this->horizontalInsideBorderChar = $inside ?? $outside;
90 return $this;
91 }
92 /**
93 * Sets vertical border characters.
94 *
95 * <code>
96 * ╔═══════════════╤══════════════════════════╤══════════════════╗
97 * ║ ISBN │ Title │ Author ║
98 * ╠═══════1═══════╪══════════════════════════╪══════════════════╣
99 * ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
100 * ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
101 * ╟───────2───────┼──────────────────────────┼──────────────────╢
102 * ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
103 * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
104 * ╚═══════════════╧══════════════════════════╧══════════════════╝
105 * </code>
106 *
107 * @return $this
108 */
109 public function setVerticalBorderChars(string $outside, ?string $inside = null) : self
110 {
111 $this->verticalOutsideBorderChar = $outside;
112 $this->verticalInsideBorderChar = $inside ?? $outside;
113 return $this;
114 }
115 /**
116 * Gets border characters.
117 *
118 * @internal
119 */
120 public function getBorderChars() : array
121 {
122 return [$this->horizontalOutsideBorderChar, $this->verticalOutsideBorderChar, $this->horizontalInsideBorderChar, $this->verticalInsideBorderChar];
123 }
124 /**
125 * Sets crossing characters.
126 *
127 * Example:
128 * <code>
129 * 1═══════════════2══════════════════════════2══════════════════3
130 * ║ ISBN │ Title │ Author ║
131 * 8'══════════════0'═════════════════════════0'═════════════════4'
132 * ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
133 * ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
134 * 8───────────────0──────────────────────────0──────────────────4
135 * ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
136 * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
137 * 7═══════════════6══════════════════════════6══════════════════5
138 * </code>
139 *
140 * @param string $cross Crossing char (see #0 of example)
141 * @param string $topLeft Top left char (see #1 of example)
142 * @param string $topMid Top mid char (see #2 of example)
143 * @param string $topRight Top right char (see #3 of example)
144 * @param string $midRight Mid right char (see #4 of example)
145 * @param string $bottomRight Bottom right char (see #5 of example)
146 * @param string $bottomMid Bottom mid char (see #6 of example)
147 * @param string $bottomLeft Bottom left char (see #7 of example)
148 * @param string $midLeft Mid left char (see #8 of example)
149 * @param string|null $topLeftBottom Top left bottom char (see #8' of example), equals to $midLeft if null
150 * @param string|null $topMidBottom Top mid bottom char (see #0' of example), equals to $cross if null
151 * @param string|null $topRightBottom Top right bottom char (see #4' of example), equals to $midRight if null
152 *
153 * @return $this
154 */
155 public function setCrossingChars(string $cross, string $topLeft, string $topMid, string $topRight, string $midRight, string $bottomRight, string $bottomMid, string $bottomLeft, string $midLeft, ?string $topLeftBottom = null, ?string $topMidBottom = null, ?string $topRightBottom = null) : self
156 {
157 $this->crossingChar = $cross;
158 $this->crossingTopLeftChar = $topLeft;
159 $this->crossingTopMidChar = $topMid;
160 $this->crossingTopRightChar = $topRight;
161 $this->crossingMidRightChar = $midRight;
162 $this->crossingBottomRightChar = $bottomRight;
163 $this->crossingBottomMidChar = $bottomMid;
164 $this->crossingBottomLeftChar = $bottomLeft;
165 $this->crossingMidLeftChar = $midLeft;
166 $this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
167 $this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
168 $this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;
169 return $this;
170 }
171 /**
172 * Sets default crossing character used for each cross.
173 *
174 * @see {@link setCrossingChars()} for setting each crossing individually.
175 */
176 public function setDefaultCrossingChar(string $char) : self
177 {
178 return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
179 }
180 /**
181 * Gets crossing character.
182 *
183 * @return string
184 */
185 public function getCrossingChar()
186 {
187 return $this->crossingChar;
188 }
189 /**
190 * Gets crossing characters.
191 *
192 * @internal
193 */
194 public function getCrossingChars() : array
195 {
196 return [$this->crossingChar, $this->crossingTopLeftChar, $this->crossingTopMidChar, $this->crossingTopRightChar, $this->crossingMidRightChar, $this->crossingBottomRightChar, $this->crossingBottomMidChar, $this->crossingBottomLeftChar, $this->crossingMidLeftChar, $this->crossingTopLeftBottomChar, $this->crossingTopMidBottomChar, $this->crossingTopRightBottomChar];
197 }
198 /**
199 * Sets header cell format.
200 *
201 * @return $this
202 */
203 public function setCellHeaderFormat(string $cellHeaderFormat)
204 {
205 $this->cellHeaderFormat = $cellHeaderFormat;
206 return $this;
207 }
208 /**
209 * Gets header cell format.
210 *
211 * @return string
212 */
213 public function getCellHeaderFormat()
214 {
215 return $this->cellHeaderFormat;
216 }
217 /**
218 * Sets row cell format.
219 *
220 * @return $this
221 */
222 public function setCellRowFormat(string $cellRowFormat)
223 {
224 $this->cellRowFormat = $cellRowFormat;
225 return $this;
226 }
227 /**
228 * Gets row cell format.
229 *
230 * @return string
231 */
232 public function getCellRowFormat()
233 {
234 return $this->cellRowFormat;
235 }
236 /**
237 * Sets row cell content format.
238 *
239 * @return $this
240 */
241 public function setCellRowContentFormat(string $cellRowContentFormat)
242 {
243 $this->cellRowContentFormat = $cellRowContentFormat;
244 return $this;
245 }
246 /**
247 * Gets row cell content format.
248 *
249 * @return string
250 */
251 public function getCellRowContentFormat()
252 {
253 return $this->cellRowContentFormat;
254 }
255 /**
256 * Sets table border format.
257 *
258 * @return $this
259 */
260 public function setBorderFormat(string $borderFormat)
261 {
262 $this->borderFormat = $borderFormat;
263 return $this;
264 }
265 /**
266 * Gets table border format.
267 *
268 * @return string
269 */
270 public function getBorderFormat()
271 {
272 return $this->borderFormat;
273 }
274 /**
275 * Sets cell padding type.
276 *
277 * @return $this
278 */
279 public function setPadType(int $padType)
280 {
281 if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], \true)) {
282 throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
283 }
284 $this->padType = $padType;
285 return $this;
286 }
287 /**
288 * Gets cell padding type.
289 *
290 * @return int
291 */
292 public function getPadType()
293 {
294 return $this->padType;
295 }
296 public function getHeaderTitleFormat() : string
297 {
298 return $this->headerTitleFormat;
299 }
300 /**
301 * @return $this
302 */
303 public function setHeaderTitleFormat(string $format) : self
304 {
305 $this->headerTitleFormat = $format;
306 return $this;
307 }
308 public function getFooterTitleFormat() : string
309 {
310 return $this->footerTitleFormat;
311 }
312 /**
313 * @return $this
314 */
315 public function setFooterTitleFormat(string $format) : self
316 {
317 $this->footerTitleFormat = $format;
318 return $this;
319 }
320 }
321