Skip to content

Commit

Permalink
Fix CS/WS issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Oct 19, 2017
1 parent 4cc6fe6 commit 79b4d0a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/DataSet/AbstractTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,8 @@ public function __toString()
{
$columns = $this->getTableMetaData()->getColumns();
$count = \count($columns);
// if count less than 0 (when table is empty), then set count to one

// if count less than 0 (when table is empty), then set count to 1
$count = $count >= 1 ? $count : 1;
$lineSeperator = \str_repeat('+----------------------', $count) . "+\n";
$lineLength = \strlen($lineSeperator) - 1;
Expand Down Expand Up @@ -215,15 +216,17 @@ protected function rowToString(array $row)
$rowString = '';

foreach ($row as $value) {
if (\is_null($value)) {
if (null === $value) {
$value = 'NULL';
}

$value_str = \mb_substr($value, 0, 20);

// make str_pad act in multibyte manner
$correction = \strlen($value_str) - \mb_strlen($value_str);
$rowString .= '| ' . \str_pad($value_str, 20 + $correction, ' ', STR_PAD_BOTH) . ' ';
}

/** @see https://github.com/sebastianbergmann/dbunit/issues/195 */
$rowString = !empty($row) ? $rowString . "|\n" : '';

Expand Down

0 comments on commit 79b4d0a

Please sign in to comment.