From 4d4b774f251f217fed25892983b6b5c2167d659c Mon Sep 17 00:00:00 2001
From: Slava Abakumov <slaFFik@users.noreply.github.com>
Date: Thu, 28 Sep 2023 23:10:13 +0200
Subject: [PATCH 1/2] Table::getDisplayLines() should not output excessive
 lines

Fix #164.
---
 lib/cli/Table.php | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)

diff --git a/lib/cli/Table.php b/lib/cli/Table.php
index 8b0cf93..69cba80 100644
--- a/lib/cli/Table.php
+++ b/lib/cli/Table.php
@@ -148,14 +148,16 @@ public function getDisplayLines() {
 			$out[] = $border;
 		}
 
-		foreach ($this->_rows as $row) {
-			$row = $this->_renderer->row($row);
-			$row = explode( PHP_EOL, $row );
-			$out = array_merge( $out, $row );
-		}
+		if ($this->_rows) {
+			foreach ($this->_rows as $row) {
+				$row = $this->_renderer->row($row);
+				$row = explode( PHP_EOL, $row );
+				$out = array_merge( $out, $row );
+			}
 
-		if (isset($border)) {
-			$out[] = $border;
+			if (isset($border)) {
+				$out[] = $border;
+			}
 		}
 
 		if ($this->_footers) {

From f49274652e4e18d96fb8afe001c04be6a36379b4 Mon Sep 17 00:00:00 2001
From: Slava Abakumov <slaFFik@users.noreply.github.com>
Date: Fri, 29 Sep 2023 18:43:58 +0200
Subject: [PATCH 2/2] fix testDrawWithHeadersNoData()

---
 tests/test-table-ascii.php | 1 -
 1 file changed, 1 deletion(-)

diff --git a/tests/test-table-ascii.php b/tests/test-table-ascii.php
index 7235097..a96dfef 100644
--- a/tests/test-table-ascii.php
+++ b/tests/test-table-ascii.php
@@ -249,7 +249,6 @@ public function testDrawWithHeadersNoData() {
 +----------+----------+
 | header 1 | header 2 |
 +----------+----------+
-+----------+----------+
 
 OUT;
 		$this->assertInOutEquals(array($headers, $rows), $output);