public function getRestartCommand($os, $distVersion = null)
{
// check if the restart command is registered
if (array_key_exists($os, $this->restartCommands)) {
// check whether or not we got an array, if so we have to check for the version
$command = $this->restartCommands[$os];
if (is_array($command)) {
// if we do have a certain version we have to determine the command
if (!is_null($distVersion)) {
// floor the dist version for comparison
$distVersion = (int) floor((double) $distVersion);
foreach ($command as $version => $potentialCommand) {
if ($distVersion === $version) {
$command = $potentialCommand;
break;
}
}
}
// if we did not find anything we have to take the default command
if (is_array($command)) {
$command = $command['default'];
}
}
// for Mac OS X the base directory has to be appended
if ($os === DeploymentScanner::DARWIN) {
$command = $this->getService()->realpath($command);
}
// return the command
return $command;
}
// throw an exception if the restart command is not available
throw new \Exception("Can't find restart command for OS {$os}");
}