Skip to content

Commit a03fa80

Browse files
authored
Apply fixes from StyleCI (#108)
[ci skip] [skip ci] Co-authored-by: Jitendra <[email protected]>
1 parent 6092763 commit a03fa80

File tree

3 files changed

+191
-188
lines changed

3 files changed

+191
-188
lines changed

src/Output/Table.php

+7-7
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function render(array $rows, array $styles = []): string
4848
$title = $body = $dash = $positions = [];
4949

5050
[$start, $end] = $styles['head'];
51-
$pos = 0;
51+
$pos = 0;
5252
foreach ($head as $col => $size) {
5353
$dash[] = str_repeat('-', $size + 2);
5454
$title[] = str_pad($this->toWords($col), $size, ' ');
@@ -68,11 +68,11 @@ public function render(array $rows, array $styles = []): string
6868

6969
if (isset($styles[$line . ':' . $colNumber])) { // cell, 1:1
7070
$style = $styles[$line . ':' . $colNumber];
71-
} else if (isset($styles[$col]) || isset($styles['*:' . $colNumber])) { // col, *:2 or b
71+
} elseif (isset($styles[$col]) || isset($styles['*:' . $colNumber])) { // col, *:2 or b
7272
$style = $styles['*:' . $colNumber] ?? $styles[$col];
73-
} else if (isset($styles[$line . ':*'])) { // row, 2:*
73+
} elseif (isset($styles[$line . ':*'])) { // row, 2:*
7474
$style = $styles[$line . ':*'];
75-
} else if (isset($styles['*:*'])) { // any cell, *:*
75+
} elseif (isset($styles['*:*'])) { // any cell, *:*
7676
$style = $styles['*:*'];
7777
} else {
7878
$style = $styles[['even', 'odd'][(int) $odd]];
@@ -121,7 +121,7 @@ protected function normalize(array $rows): array
121121

122122
foreach ($head as $col => &$value) {
123123
$cols = array_column($rows, $col);
124-
$cols = array_map(function($col) {
124+
$cols = array_map(function ($col) {
125125
$col ??= '';
126126

127127
if (preg_match('/(\\x1b(?:.+)m)/U', $col, $matches)) {
@@ -152,8 +152,8 @@ protected function normalizeStyles(array $styles): array
152152
foreach ($styles as $for => $style) {
153153
if (is_string($style) && $style !== '') {
154154
$default[$for] = ['<' . trim($style, '<> ') . '>', '</end>'];
155-
} else if (str_contains($for, ':') && is_callable($style)) {
156-
$default[$for] = $style;
155+
} elseif (str_contains($for, ':') && is_callable($style)) {
156+
$default[$for] = $style;
157157
}
158158
}
159159

src/Output/Writer.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -321,9 +321,9 @@ public function justify(string $first, ?string $second = null, array $options =
321321
'sep' => $options['sep'] ?? '.',
322322
];
323323

324-
$second = (string) $second;
324+
$second = (string) $second;
325325
$terminalWidth = $this->terminal->width() ?? 80;
326-
$dashWidth = $terminalWidth - (strlen($first) + strlen($second));
326+
$dashWidth = $terminalWidth - (strlen($first) + strlen($second));
327327
// remove left and right margins because we're going to add 1 space on each side (after/before the text).
328328
// if we don't have a second element, we just remove the left margin
329329
$dashWidth -= $second === '' ? 1 : 2;

0 commit comments

Comments
 (0)