Skip to content

Commit dd70d46

Browse files
committed
[Console] added TableCellStyle
1 parent b2b1efe commit dd70d46

File tree

3 files changed

+4
-25
lines changed

3 files changed

+4
-25
lines changed

src/Symfony/Component/Console/Helper/Table.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -518,7 +518,7 @@ private function renderCell(array $row, int $column, string $cellFormat): string
518518
if ($cell instanceof TableCell && $cell->getStyle() instanceof TableCellStyle) {
519519
$isNotStyledByTag = !preg_match('/^<(\w+|(\w+=[\w,]+;?)*)>.+<\/(\w+|(\w+=\w+;?)*)?>$/', $cell);
520520
if ($isNotStyledByTag) {
521-
if ($cell->hasCellFormat()) {
521+
if ($cell->getStyle()->hasCellFormat()) {
522522
$cellFormat = $cell->getStyle()->getCellFormat();
523523
} else {
524524
$tag = http_build_query($cell->getStyle()->getTagOptions(), null, ';');
@@ -535,7 +535,7 @@ private function renderCell(array $row, int $column, string $cellFormat): string
535535
}
536536
}
537537

538-
if ($cell->hasAlign()) {
538+
if ($cell->getStyle()->hasAlign()) {
539539
$padType = $cell->getStyle()->getPadByAlign();
540540
}
541541
}

src/Symfony/Component/Console/Helper/TableCell.php

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -75,20 +75,4 @@ public function getStyle(): ?TableCellStyle
7575
{
7676
return $this->options['style'];
7777
}
78-
79-
public function hasAlign(): bool
80-
{
81-
$style = $this->getStyle();
82-
83-
return $style instanceof TableCellStyle
84-
&& $style->hasAlign();
85-
}
86-
87-
public function hasCellFormat(): bool
88-
{
89-
$style = $this->getStyle();
90-
91-
return $style instanceof TableCellStyle
92-
&& $style->getCellFormat();
93-
}
9478
}

src/Symfony/Component/Console/Helper/TableCellStyle.php

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -89,16 +89,11 @@ public function getCellFormat(): ?string
8989

9090
public function hasAlign(): bool
9191
{
92-
$options = $this->getOptions();
93-
94-
return isset($options['align'])
95-
&& self::DEFAULT_ALIGN !== $options['align'];
92+
return isset($this->getOptions()['align']) && self::DEFAULT_ALIGN !== $this->getOptions()['align'];
9693
}
9794

9895
public function hasCellFormat(): bool
9996
{
100-
$options = $this->getOptions();
101-
102-
return isset($options['cellFormat']) && \is_string($options['cellFormat']);
97+
return isset($this->getOptions()['cellFormat']) && \is_string($this->getOptions()['cellFormat']);
10398
}
10499
}

0 commit comments

Comments
 (0)