Returns the PO file path either by default or for
a specified environment
@param  string $env (optional) An environment
@return string
514667
public function getPoFilePath($env = null)
    {
        $localeDir = Strata::getLocalePath();

        if (!is_null($env)) {
            return $localeDir . $this->getCode() . '-' . $env . '.po';
        }

        return $localeDir . $this->getCode() . '.po';
    }
131279
protected function envFileToUseForDefaults()
    {
        $file = config('setup.dot_env.default_file');

        if ($this->envFileExist() &&
            $this->command->confirm('Existing .env file was found. Use it for defaults?', true)
        )
        {
            $file = '.env';
        }

        return $file;
    }
599248
def get_environment_paths(config, env):
    
    if env is None:
        return config.get(Config.DEFAULTS, 'environment')

    # Config option takes precedence over environment key.
    if config.has_option(Config.ENVIRONMENTS, env):
        env = config.get(Config.ENVIRONMENTS, env).replace(' ', '').split(';')
    else:
        env = os.getenv(env)
        if env:
            env = env.split(os.pathsep)
    return [i for i in env if i]
439840
protected function buildEnvironmentVariables($env)
    {
        $variables = '';
        foreach ($env as $key => $value) {
            $variables .= $key.'='.$value.' ';
        }

        return trim($variables);
    }
1257860
protected function get_env_for_read_or_fail()
    {
        try {
            return File::at($this->resolve_file_path())->load();
        } catch (\Exception $e) {
            WP_CLI::error($e->getMessage());
        }
    }
1248651
public function setEnv($env)
    {
        if (! $env) $env = self::ENV_DEVELOPMENT;

        $this->env = $env;
        $this->config('env', $this->env);
        return $this->getEnv();
    }
496160
public static function getEnv($key = '')
    {
        if (self::$env_setting === null) {
            return self::get($key);
        }

        $arr = explode('.', $key);

        $value = null;
        foreach ($arr as $kv) {
            if (empty($kv)) {
                $value = null;
                break;
            }
            if ($value === null) {
                if (isset(self::$env_setting->$kv)) {
                    $value =  self::$env_setting->$kv;
                    continue;
                }
                $value = null;
                break;
            } else {
                if (isset($value->$kv)) {
                    $value =  $value->$kv;
                    continue;
                }
                $value = null;
                break;
            }
        }

        if ($value === null) {
            return self::get($key);
        }
        return $value;
    }
1064351
public static function Option($optionName = null, $envVariableName = null, $default = false) {
		if (empty($optionName) && empty($envVariableName)) {
			return $default;
		}

		if ($envVariableName == null) {
			$envVariableName = str_replace('-','_', strtoupper($optionName));
		}

		if (is_array($envVariableName)) {
			foreach($envVariableName as $envVariable) {
				$envval = getenv($envVariable);
				if ($envval) {
					return $envval;
				}
			}
		} else {
			$envval = getenv($envVariableName);
			if ($envval) {
				return $envval;
			}
		}

		if (empty($optionName)) {
			return $default;
		}

		return get_option($optionName, $default);
	}
1172000
public static function getEnv($name)
    {
        switch (true) {
            case  is_array(static::$env) && array_key_exists($name, static::$env):
                return static::$env[$name];
            case  is_array($_ENV) && array_key_exists($name, $_ENV):
                return $_ENV[$name];
            case  is_array($_SERVER) && array_key_exists($name, $_SERVER):
                return $_SERVER[$name];
            default:
                return getenv($name);
        }
    }
1189160
public function getEnv($key = null, $default = null)
    {
        if (null === $key)
        {
            return $_ENV;
        }

        return (isset($_ENV[$key])) ? $_ENV[$key] : $default;
    }
932108
public static function selectEnvironment($env = null) 
    {
        if (strlen($env) < 1) {
            $getenv = self::_getEnvironment();
            if (strlen($getenv) > 0) {
                $env = $getenv;
            } else {
                $env = "development";
            }
        }
        return $env;
    }
931552
static function getConfiguration(array $env): Configuration {
    $repoName = $env['APPVEYOR_REPO_NAME'] ?? null;
    $serviceNumber = $env['APPVEYOR_BUILD_VERSION'] ?? null;

    return new Configuration([
      'commit_sha' => $env['APPVEYOR_REPO_COMMIT'] ?? null,
      'git_author_email' => $env['APPVEYOR_REPO_COMMIT_AUTHOR_EMAIL'] ?? null,
      'git_author_name' => $env['APPVEYOR_REPO_COMMIT_AUTHOR'] ?? null,
      'git_message' => $env['APPVEYOR_REPO_COMMIT_MESSAGE'] ?? null,
      'service_branch' => $env['APPVEYOR_REPO_BRANCH'] ?? null,
      'service_build_url' => $repoName && $serviceNumber ? "https://ci.appveyor.com/project/$repoName/build/$serviceNumber" : null,
      'service_job_id' => $env['APPVEYOR_BUILD_ID'] ?? null,
      'service_job_number' => $env['APPVEYOR_BUILD_NUMBER'] ?? null,
      'service_name' => 'appveyor',
      'service_number' => $serviceNumber
    ]);
  }
1208455
protected function getParentEnv()
    {
        if (PHP_VERSION_ID >= 70100) {
            return getenv();
        }
        // In PHP <7.1 there isn't a way to read all of the current environment
        // variables. If PHP is running with a variables_order that includes
        // 'e', then $_ENV should be populated.
        if (!empty($_ENV) && stripos(ini_get('variables_order'), 'e') !== false) {
            return $_ENV;
        }

        // If $_ENV is empty, then we can only use a whitelist of all the
        // variables that we might want to use.
        $candidates = [
            'TERM',
            'TERM_SESSION_ID',
            'TMPDIR',
            'SSH_AGENT_PID',
            'SSH_AUTH_SOCK',
            'PATH',
            'LANG',
            'LC_ALL',
            'LC_CTYPE',
            'PAGER',
            'LESS',
        ];
        $variables = [];
        foreach ($candidates as $name) {
            $variables[$name] = getenv($name);
        }

        return array_filter($variables, function ($value) {
            return $value !== false;
        });
    }
1174559
protected function findFilePath()
    {
        $filename = static::FILE_NAME;

        foreach ($this->defaultLocations() as $location) {
            if (file_exists("{$location}/$filename")) {
                return $location;
            }
        }

        return $this->defaultFilePath();
    }
88491
public function loadConfigDir($dir, $env = null)
    {
        !$env && $env = $this->name;
        $config = $this->getFileConfig($dir . '/config.php');
        $envConfig = $this->getFileConfig($dir . '/config-' . $env . '.php');
        $config = array_replace_recursive($config, $envConfig);
        $this->wei->setConfig($config);
        return $this;
    }
1290135
def get_conf_path_from_env():
    '''
    
    '''
    config_path = os.environ.get('PECAN_CONFIG')
    if not config_path:
        error = "PECAN_CONFIG is not set and " \
                "no config file was passed as an argument."
    elif not os.path.isfile(config_path):
        error = "PECAN_CONFIG was set to an invalid path: %s" % config_path
    else:
        return config_path

    raise RuntimeError(error)
493919
static Path getEnvironemtVariableConfigFilePath() {
        final String value = System.getenv(ENVIRONMENT_CONFIG_VARIABLE_NAME);
        return Paths.get(value);
    }