Skip to content

Commit a623efe

Browse files
committed
bug fixed for show mesage
1 parent b26ccff commit a623efe

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

src/utils/Show.php

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,10 +343,16 @@ public static function helpPanel($usage, $commands = [], $options = [], $example
343343
* @param mixed $data
344344
* @param string $title
345345
* @param string $borderChar
346-
* @return void
346+
* @return int
347347
*/
348348
public static function panel($data, $title='Information Panel', $borderChar = '*')
349349
{
350+
if (!$data) {
351+
self::write('<info>No data to display!</info>');
352+
353+
return -404;
354+
}
355+
350356
$data = is_array($data) ? array_filter($data) : [trim($data)];
351357
$title = trim($title);
352358

@@ -423,6 +429,7 @@ public static function panel($data, $title='Information Panel', $borderChar = '*
423429
}
424430

425431
unset($panelData);
432+
return 0;
426433
}
427434

428435
/**
@@ -454,9 +461,16 @@ public static function panel($data, $title='Information Panel', $borderChar = '*
454461
* ];
455462
* Show::table($data, 'a table', $opts);
456463
* ```
464+
* @return int
457465
*/
458466
public static function table(array $data, $title='Info List', array $opts = [])
459467
{
468+
if (!$data) {
469+
self::write('<info>No data to display!</info>');
470+
471+
return -404;
472+
}
473+
460474
$opts = array_merge([
461475
'showBorder' => true,
462476
'leftIndent' => ' ',
@@ -572,6 +586,8 @@ public static function table(array $data, $title='Info List', array $opts = [])
572586
}
573587

574588
self::write('');
589+
590+
return 0;
575591
}
576592

577593

0 commit comments

Comments
 (0)