Skip to content

Commit d55abb9

Browse files
authored
Merge pull request #4 from gilbite/countable
fix some minor bugs that `count()` non-countable values
2 parents 09f516f + fc8d60f commit d55abb9

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

lib/SimpleTable.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ function __construct()
7777

7878
// Padding
7979
foreach ($cache as $col) {
80-
while ($col[2] < $max) {
80+
while (count($col[2]) < $max) {
8181
array_push($col[2], '');
8282
}
8383
}
@@ -141,7 +141,7 @@ public function draw()
141141

142142
$title = 0;
143143
foreach ($this->columns as $column) {
144-
if ($title < count($column[0])) $title = count($column[2]);
144+
if ($title < count($column[2])) $title = count($column[2]);
145145
}
146146

147147
if ($title) {
@@ -263,7 +263,7 @@ public function row()
263263
// Shortcut
264264
if ($size < 0) return $this;
265265

266-
for ($i = 0; $i < count($size) + 1; $i++) {
266+
for ($i = 0; $i < $size + 1; $i++) {
267267
if ($size <= count($texts)) break;
268268
array_push($texts, '');
269269
}

0 commit comments

Comments
 (0)