protected function parseEnv(string $param, array $variables, int $key): string
    {
        $env = getenv($variables[1][$key]);
        if (false === $env && !empty($variables[3][$key])) {
            return str_replace($variables[0][$key], $variables[3][$key], $param);
        }
        if (false === $env) {
            throw new Exception\EnvVariableNotFound('env variable '.$variables[1][$key].' required but it is neither set not a default value exists');
        }

        return str_replace($variables[0][$key], $env, $param);
    }