[Console] make it possible to pass a style directly to Table::setStyle()
This commit is contained in:
parent
14caaec5f6
commit
21784ced7a
@ -110,20 +110,20 @@ class Table
|
||||
/**
|
||||
* Sets table style.
|
||||
*
|
||||
* @param string $name The style name
|
||||
* @param TableStyle|string $name The style name or a TableStyle instance
|
||||
*
|
||||
* @return Table
|
||||
*/
|
||||
public function setStyle($name)
|
||||
{
|
||||
if (isset(self::$styles[$name])) {
|
||||
if ($name instanceof TableStyle) {
|
||||
$this->style = $name;
|
||||
} elseif (isset(self::$styles[$name])) {
|
||||
$this->style = self::$styles[$name];
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
} else {
|
||||
throw new \InvalidArgumentException(sprintf('Style "%s" is not defined.', $name));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the current table style.
|
||||
|
Reference in New Issue
Block a user