Return egg "done" checks as an array rather than a string

This commit is contained in:
Dane Everitt 2020-08-04 20:34:44 -07:00
parent 26704a2d5f
commit 164d6ef2e4
No known key found for this signature in database
GPG key ID: EEA66103B3D71F53

View file

@ -51,12 +51,30 @@ class EggConfigurationService
);
return [
'startup' => json_decode($server->egg->inherit_config_startup),
'startup' => $this->convertStartupToNewFormat(json_decode($server->egg->inherit_config_startup, true)),
'stop' => $this->convertStopToNewFormat($server->egg->inherit_config_stop),
'configs' => $configs,
];
}
/**
* Convert the "done" variable into an array if it is not currently one.
*
* @param array $startup
* @return array
*/
protected function convertStartupToNewFormat(array $startup)
{
$done = Arr::get($startup, 'done');
return array_filter([
'done' => is_string($done) ? [$done] : $done,
'user_interaction' => Arr::get($startup, 'userInteraction'),
], function ($datum) {
return ! is_null($datum);
});
}
/**
* Converts a legacy stop string into a new generation stop option for a server.
*