X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fconsole%2FHelper%2FTable.php;fp=vendor%2Fsymfony%2Fconsole%2FHelper%2FTable.php;h=81d0e427f473df57b4854abc44ab9ce90573e004;hp=574e9b46e4a2446383074ead550efaa756c62ead;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/vendor/symfony/console/Helper/Table.php b/vendor/symfony/console/Helper/Table.php index 574e9b46e..81d0e427f 100644 --- a/vendor/symfony/console/Helper/Table.php +++ b/vendor/symfony/console/Helper/Table.php @@ -26,29 +26,23 @@ class Table { /** * Table headers. - * - * @var array */ private $headers = array(); /** * Table rows. - * - * @var array */ private $rows = array(); /** * Column widths cache. - * - * @var array */ private $effectiveColumnWidths = array(); /** * Number of columns cache. * - * @var array + * @var int */ private $numberOfColumns; @@ -269,6 +263,7 @@ class Table * Renders table to output. * * Example: + * * +---------------+-----------------------+------------------+ * | ISBN | Title | Author | * +---------------+-----------------------+------------------+ @@ -276,6 +271,7 @@ class Table * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | * +---------------+-----------------------+------------------+ + * */ public function render() { @@ -309,7 +305,7 @@ class Table /** * Renders horizontal header separator. * - * Example: +-----+-----------+-------+ + * Example: +-----+-----------+-------+ */ private function renderRowSeparator() { @@ -340,7 +336,7 @@ class Table /** * Renders table row. * - * Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * Example: | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | * * @param array $row * @param string $cellFormat @@ -458,11 +454,16 @@ class Table * @param int $line * * @return array + * + * @throws InvalidArgumentException */ - private function fillNextRows($rows, $line) + private function fillNextRows(array $rows, $line) { $unmergedRows = array(); foreach ($rows[$line] as $column => $cell) { + if (null !== $cell && !$cell instanceof TableCell && !is_scalar($cell) && !(is_object($cell) && method_exists($cell, '__toString'))) { + throw new InvalidArgumentException(sprintf('A cell must be a TableCell, a scalar or an object implementing __toString, %s given.', gettype($cell))); + } if ($cell instanceof TableCell && $cell->getRowspan() > 1) { $nbLines = $cell->getRowspan() - 1; $lines = array($cell); @@ -510,8 +511,6 @@ class Table /** * fill cells for a row that contains colspan > 1. * - * @param array $row - * * @return array */ private function fillCells($row) @@ -536,7 +535,7 @@ class Table * * @return array */ - private function copyRow($rows, $line) + private function copyRow(array $rows, $line) { $row = $rows[$line]; foreach ($row as $cellKey => $cellValue) { @@ -552,8 +551,6 @@ class Table /** * Gets number of columns by row. * - * @param array $row - * * @return int */ private function getNumberOfColumns(array $row) @@ -569,11 +566,9 @@ class Table /** * Gets list of columns for the given row. * - * @param array $row - * * @return array */ - private function getRowColumns($row) + private function getRowColumns(array $row) { $columns = range(0, $this->numberOfColumns - 1); foreach ($row as $cellKey => $cell) { @@ -588,10 +583,8 @@ class Table /** * Calculates columns widths. - * - * @param array $rows */ - private function calculateColumnsWidth($rows) + private function calculateColumnsWidth(array $rows) { for ($column = 0; $column < $this->numberOfColumns; ++$column) { $lengths = array();