Skip to content

Commit

Permalink
fix has servers check
Browse files Browse the repository at this point in the history
Signed-off-by: Dieter Coopman <[email protected]>
  • Loading branch information
dietercoopman committed Mar 21, 2023
1 parent 8fffa6b commit c557efb
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
1 change: 0 additions & 1 deletion src/ServerList.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ public function execute( InputInterface $input, OutputInterface $output): int
{
$this->title();

render('<div class="ml-1 mb-1">Here\'s a list of all saved servers.</div>');
(new Configurator())->list();

return 0;
Expand Down
2 changes: 2 additions & 0 deletions src/Services/Configurator.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ public function list()
{
$counter = 1;
if (isset($this->getConfig()['servers'])) {
render('<div class="ml-1 mb-1">Here\'s a list of all saved servers.</div>');

collect($this->getConfig()['servers'])->each(function ($server) use (&$counter) {
render("<span class='ml-1'>{$counter}. {$server['name']} ({$server['host']})</span>");
$counter++;
Expand Down
13 changes: 8 additions & 5 deletions src/Traits/HasServer.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@

trait HasServer
{
public function getServers($configurator){
public function getServers($configurator)
{
$ret = [];
$counter = 1;
foreach($configurator->getConfig()['servers'] as $key => $server){
$ret[$counter] = $server['name'];
$counter++;
if (isset($configurator->getConfig()['servers'])) {
$counter = 1;
foreach ($configurator->getConfig()['servers'] as $key => $server) {
$ret[$counter] = $server['name'];
$counter++;
}
}
return $ret;
}
Expand Down

0 comments on commit c557efb

Please sign in to comment.