PluginProbe ʕ •ᴥ•ʔ
Independent Analytics – WordPress Analytics Plugin / 2.2.0
Independent Analytics – WordPress Analytics Plugin v2.2.0
2.15.0 2.14.10 trunk 1.1 1.10 1.10.1 1.11 1.12 1.13 1.14 1.15 1.16 1.17 1.17.1 1.17.2 1.17.3 1.17.4 1.18 1.18.1 1.19.0 1.19.1 1.2 1.20.0 1.21.0 1.22.0 1.22.1 1.23.0 1.23.1 1.24.0 1.24.1 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.28.1 1.28.2 1.28.3 1.29.0 1.3 1.30.0 1.30.1 1.4 1.5 1.6 1.7 1.8 1.9 2.0.0 2.0.1 2.1.4 2.1.5 2.1.6 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.10 2.11.2 2.11.3 2.11.4 2.11.5 2.11.6 2.11.7 2.11.8 2.11.9 2.12.0 2.12.1 2.12.2 2.13.1 2.13.2 2.13.5 2.13.6 2.14.0 2.14.1 2.14.2 2.14.4 2.14.6 2.14.7 2.14.8 2.14.9 2.2.0 2.2.1 2.3.1 2.3.2 2.4.2 2.4.3 2.5.0 2.5.1 2.6.0 2.6.1 2.6.2 2.6.3 2.6.4 2.7.0 2.7.1 2.7.2 2.7.3 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7
independent-analytics / vendor / symfony / console / Helper / TableStyle.php
independent-analytics / vendor / symfony / console / Helper Last commit date
DebugFormatterHelper.php 2 years ago DescriptorHelper.php 2 years ago Dumper.php 2 years ago FormatterHelper.php 2 years ago Helper.php 2 years ago HelperInterface.php 2 years ago HelperSet.php 2 years ago InputAwareHelper.php 2 years ago ProcessHelper.php 2 years ago ProgressBar.php 2 years ago ProgressIndicator.php 2 years ago QuestionHelper.php 2 years ago SymfonyQuestionHelper.php 2 years ago Table.php 2 years ago TableCell.php 2 years ago TableCellStyle.php 2 years ago TableRows.php 3 years ago TableSeparator.php 2 years ago TableStyle.php 2 years ago
TableStyle.php
322 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 IAWP_SCOPED\Symfony\Component\Console\Helper;
12
13 use IAWP_SCOPED\Symfony\Component\Console\Exception\InvalidArgumentException;
14 use IAWP_SCOPED\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 * @internal
22 */
23 class TableStyle
24 {
25 private $paddingChar = ' ';
26 private $horizontalOutsideBorderChar = '-';
27 private $horizontalInsideBorderChar = '-';
28 private $verticalOutsideBorderChar = '|';
29 private $verticalInsideBorderChar = '|';
30 private $crossingChar = '+';
31 private $crossingTopRightChar = '+';
32 private $crossingTopMidChar = '+';
33 private $crossingTopLeftChar = '+';
34 private $crossingMidRightChar = '+';
35 private $crossingBottomRightChar = '+';
36 private $crossingBottomMidChar = '+';
37 private $crossingBottomLeftChar = '+';
38 private $crossingMidLeftChar = '+';
39 private $crossingTopLeftBottomChar = '+';
40 private $crossingTopMidBottomChar = '+';
41 private $crossingTopRightBottomChar = '+';
42 private $headerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
43 private $footerTitleFormat = '<fg=black;bg=white;options=bold> %s </>';
44 private $cellHeaderFormat = '<info>%s</info>';
45 private $cellRowFormat = '%s';
46 private $cellRowContentFormat = ' %s ';
47 private $borderFormat = '%s';
48 private $padType = \STR_PAD_RIGHT;
49 /**
50 * Sets padding character, used for cell padding.
51 *
52 * @return $this
53 */
54 public function setPaddingChar(string $paddingChar)
55 {
56 if (!$paddingChar) {
57 throw new LogicException('The padding char must not be empty.');
58 }
59 $this->paddingChar = $paddingChar;
60 return $this;
61 }
62 /**
63 * Gets padding character, used for cell padding.
64 *
65 * @return string
66 */
67 public function getPaddingChar()
68 {
69 return $this->paddingChar;
70 }
71 /**
72 * Sets horizontal border characters.
73 *
74 * <code>
75 * ╔═══════════════╤══════════════════════════╤══════════════════╗
76 * 1 ISBN 2 Title │ Author ║
77 * ╠═══════════════╪══════════════════════════╪══════════════════╣
78 * ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
79 * ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
80 * ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
81 * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
82 * ╚═══════════════╧══════════════════════════╧══════════════════╝
83 * </code>
84 *
85 * @return $this
86 */
87 public function setHorizontalBorderChars(string $outside, string $inside = null) : self
88 {
89 $this->horizontalOutsideBorderChar = $outside;
90 $this->horizontalInsideBorderChar = $inside ?? $outside;
91 return $this;
92 }
93 /**
94 * Sets vertical border characters.
95 *
96 * <code>
97 * ╔═══════════════╤══════════════════════════╤══════════════════╗
98 * ║ ISBN │ Title │ Author ║
99 * ╠═══════1═══════╪══════════════════════════╪══════════════════╣
100 * ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
101 * ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
102 * ╟───────2───────┼──────────────────────────┼──────────────────╢
103 * ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
104 * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
105 * ╚═══════════════╧══════════════════════════╧══════════════════╝
106 * </code>
107 *
108 * @return $this
109 */
110 public function setVerticalBorderChars(string $outside, string $inside = null) : self
111 {
112 $this->verticalOutsideBorderChar = $outside;
113 $this->verticalInsideBorderChar = $inside ?? $outside;
114 return $this;
115 }
116 /**
117 * Gets border characters.
118 *
119 * @internal
120 */
121 public function getBorderChars() : array
122 {
123 return [$this->horizontalOutsideBorderChar, $this->verticalOutsideBorderChar, $this->horizontalInsideBorderChar, $this->verticalInsideBorderChar];
124 }
125 /**
126 * Sets crossing characters.
127 *
128 * Example:
129 * <code>
130 * 1═══════════════2══════════════════════════2══════════════════3
131 * ║ ISBN │ Title │ Author ║
132 * 8'══════════════0'═════════════════════════0'═════════════════4'
133 * ║ 99921-58-10-7 │ Divine Comedy │ Dante Alighieri ║
134 * ║ 9971-5-0210-0 │ A Tale of Two Cities │ Charles Dickens ║
135 * 8───────────────0──────────────────────────0──────────────────4
136 * ║ 960-425-059-0 │ The Lord of the Rings │ J. R. R. Tolkien ║
137 * ║ 80-902734-1-6 │ And Then There Were None │ Agatha Christie ║
138 * 7═══════════════6══════════════════════════6══════════════════5
139 * </code>
140 *
141 * @param string $cross Crossing char (see #0 of example)
142 * @param string $topLeft Top left char (see #1 of example)
143 * @param string $topMid Top mid char (see #2 of example)
144 * @param string $topRight Top right char (see #3 of example)
145 * @param string $midRight Mid right char (see #4 of example)
146 * @param string $bottomRight Bottom right char (see #5 of example)
147 * @param string $bottomMid Bottom mid char (see #6 of example)
148 * @param string $bottomLeft Bottom left char (see #7 of example)
149 * @param string $midLeft Mid left char (see #8 of example)
150 * @param string|null $topLeftBottom Top left bottom char (see #8' of example), equals to $midLeft if null
151 * @param string|null $topMidBottom Top mid bottom char (see #0' of example), equals to $cross if null
152 * @param string|null $topRightBottom Top right bottom char (see #4' of example), equals to $midRight if null
153 *
154 * @return $this
155 */
156 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
157 {
158 $this->crossingChar = $cross;
159 $this->crossingTopLeftChar = $topLeft;
160 $this->crossingTopMidChar = $topMid;
161 $this->crossingTopRightChar = $topRight;
162 $this->crossingMidRightChar = $midRight;
163 $this->crossingBottomRightChar = $bottomRight;
164 $this->crossingBottomMidChar = $bottomMid;
165 $this->crossingBottomLeftChar = $bottomLeft;
166 $this->crossingMidLeftChar = $midLeft;
167 $this->crossingTopLeftBottomChar = $topLeftBottom ?? $midLeft;
168 $this->crossingTopMidBottomChar = $topMidBottom ?? $cross;
169 $this->crossingTopRightBottomChar = $topRightBottom ?? $midRight;
170 return $this;
171 }
172 /**
173 * Sets default crossing character used for each cross.
174 *
175 * @see {@link setCrossingChars()} for setting each crossing individually.
176 */
177 public function setDefaultCrossingChar(string $char) : self
178 {
179 return $this->setCrossingChars($char, $char, $char, $char, $char, $char, $char, $char, $char);
180 }
181 /**
182 * Gets crossing character.
183 *
184 * @return string
185 */
186 public function getCrossingChar()
187 {
188 return $this->crossingChar;
189 }
190 /**
191 * Gets crossing characters.
192 *
193 * @internal
194 */
195 public function getCrossingChars() : array
196 {
197 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];
198 }
199 /**
200 * Sets header cell format.
201 *
202 * @return $this
203 */
204 public function setCellHeaderFormat(string $cellHeaderFormat)
205 {
206 $this->cellHeaderFormat = $cellHeaderFormat;
207 return $this;
208 }
209 /**
210 * Gets header cell format.
211 *
212 * @return string
213 */
214 public function getCellHeaderFormat()
215 {
216 return $this->cellHeaderFormat;
217 }
218 /**
219 * Sets row cell format.
220 *
221 * @return $this
222 */
223 public function setCellRowFormat(string $cellRowFormat)
224 {
225 $this->cellRowFormat = $cellRowFormat;
226 return $this;
227 }
228 /**
229 * Gets row cell format.
230 *
231 * @return string
232 */
233 public function getCellRowFormat()
234 {
235 return $this->cellRowFormat;
236 }
237 /**
238 * Sets row cell content format.
239 *
240 * @return $this
241 */
242 public function setCellRowContentFormat(string $cellRowContentFormat)
243 {
244 $this->cellRowContentFormat = $cellRowContentFormat;
245 return $this;
246 }
247 /**
248 * Gets row cell content format.
249 *
250 * @return string
251 */
252 public function getCellRowContentFormat()
253 {
254 return $this->cellRowContentFormat;
255 }
256 /**
257 * Sets table border format.
258 *
259 * @return $this
260 */
261 public function setBorderFormat(string $borderFormat)
262 {
263 $this->borderFormat = $borderFormat;
264 return $this;
265 }
266 /**
267 * Gets table border format.
268 *
269 * @return string
270 */
271 public function getBorderFormat()
272 {
273 return $this->borderFormat;
274 }
275 /**
276 * Sets cell padding type.
277 *
278 * @return $this
279 */
280 public function setPadType(int $padType)
281 {
282 if (!\in_array($padType, [\STR_PAD_LEFT, \STR_PAD_RIGHT, \STR_PAD_BOTH], \true)) {
283 throw new InvalidArgumentException('Invalid padding type. Expected one of (STR_PAD_LEFT, STR_PAD_RIGHT, STR_PAD_BOTH).');
284 }
285 $this->padType = $padType;
286 return $this;
287 }
288 /**
289 * Gets cell padding type.
290 *
291 * @return int
292 */
293 public function getPadType()
294 {
295 return $this->padType;
296 }
297 public function getHeaderTitleFormat() : string
298 {
299 return $this->headerTitleFormat;
300 }
301 /**
302 * @return $this
303 */
304 public function setHeaderTitleFormat(string $format) : self
305 {
306 $this->headerTitleFormat = $format;
307 return $this;
308 }
309 public function getFooterTitleFormat() : string
310 {
311 return $this->footerTitleFormat;
312 }
313 /**
314 * @return $this
315 */
316 public function setFooterTitleFormat(string $format) : self
317 {
318 $this->footerTitleFormat = $format;
319 return $this;
320 }
321 }
322