Skip to content

Commit 71ba722

Browse files
committed
Fix command output
1 parent 8eac295 commit 71ba722

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

Command/GeocodeCommand.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,20 @@ protected function execute(InputInterface $input, OutputInterface $output)
6969
$max += 2;
7070

7171
foreach ($data as $key => $value) {
72+
$key = $this->humanize($key);
73+
7274
$output->writeln(sprintf(
7375
'<comment>%s</comment>: %s',
7476
str_pad($key, $max, ' ', STR_PAD_RIGHT),
75-
$value
77+
is_array($value) ? json_encode($value) : $value
7678
));
7779
}
7880
}
81+
82+
private function humanize($text)
83+
{
84+
$text = preg_replace('/([A-Z][a-z]+)|([A-Z][A-Z]+)|([^A-Za-z ]+)/', ' \1', $text);
85+
86+
return ucfirst(strtolower($text));
87+
}
7988
}

0 commit comments

Comments
 (0)