@@ -37,24 +37,29 @@ class Parser {
3737 protected const headerColor = self :: colors [2 ];
3838
3939 /**
40- * Parse the response from the server
40+ * Parse the response body from the server
4141 *
42- * @param array $response
42+ * @param $responseBody
4343 * @return void
4444 */
45- public function parseResponse ($response )
45+ public function parseResponse ($responseBody )
4646 {
47- foreach ($response as $key => $value ) {
48- if (is_array ($value ) && count ($value ) ! == 0 ) {
49- $this -> drawKeyValue($key , ' ' );
50- $this -> drawTable($value , self :: headerColor , self :: tableColor );
51- }
52- else {
53- $this -> drawKeyValue($key , $value );
47+ if (is_array ($responseBody )) {
48+ foreach ($responseBody as $key => $value ) {
49+ if (is_array ($value ) && count ($value ) ! == 0 ) {
50+ $this -> drawKeyValue($key , ' ' );
51+ $this -> drawTable($value , self :: headerColor , self :: tableColor );
52+ }
53+ else {
54+ $this -> drawKeyValue($key , $value );
55+ }
5456 }
57+ } else {
58+ printf ($responseBody );
5559 }
5660 }
5761
62+
5863 /**
5964 * Print a key value pair
6065 *
@@ -126,6 +131,13 @@ class Parser {
126131 $table -> display();
127132 }
128133
134+
135+ /**
136+ * Formats an associative array of commands and descriptions using a 80 column mask
137+ *
138+ * @param array $arr
139+ * @return void
140+ */
129141 public function formatArray (array $arr ) {
130142 $descriptionColumnLimit = 60 ;
131143 $commandNameColumnLimit = 20 ;
0 commit comments