protected function getContextualOption($option, $type, $original = null)
{
// Switch context
switch ($type) {
case 'servers':
$contextual = sprintf('rocketeer::connections.%s.servers.%d.config.%s', $this->connections->getConnection(), $this->connections->getServer(), $option);
break;
case 'stages':
$contextual = sprintf('rocketeer::on.stages.%s.%s', $this->connections->getStage(), $option);
break;
case 'connections':
$contextual = sprintf('rocketeer::on.connections.%s.%s', $this->connections->getConnection(), $option);
break;
default:
$contextual = sprintf('rocketeer::%s', $option);
break;
}
// Merge with defaults
$value = $this->config->get($contextual);
if (is_array($value) && $original) {
$value = array_replace($original, $value);
}
return $value;
}