Check environment.

@since 2.3.0
438858
private final static void checkEnvironment() {
		// Check java support.!
		boolean javaSupport = EnvUtil.isJDK7OrHigher();
		if (!javaSupport) {
			Log.error("Your Java version (", EnvUtil.getJavaersion(), ") is not supported for Audit4j. ",
					ErrorGuide.getGuide(ErrorGuide.JAVA_VERSION_ERROR));
			throw new InitializationException("Java version is not supported.");
		}
	}
534319
public function getEnvironment()
	{
		$environment_file = $this->resolvePath('config/environment');
		
		if (file_exists($environment_file)) {
			$environment = trim(file_get_contents($environment_file));
		} else {
			$environment = 'local';
		}
		
		return $environment;
	}
829015
protected boolean checkEnvironment() {
        home = getHomeDir().getAbsoluteFile();
        home.mkdirs();
        LOGGER.info(getApplicationName()+" home directory: "+home);

        // check that home exists (as mkdirs could have failed silently), otherwise throw a meaningful error
        if (!home.exists()) {
            context.setAttribute(APP,new NoHomeDirError(home));
            return false;
        }

        return true;
    }
1121716
function validateEnvironment(environment, source) {

		// not having an environment is ok
		if (!environment) {
			return;
		}

		if (Array.isArray(environment)) {
			throw new Error("Environment must not be an array");
		}

		if (typeof environment === "object") {
			Object.keys(environment).forEach(function(env) {
				if (!Environments.env) {
					var message = [
						source, ":\n",
						"\tEnvironment key \"", env, "\" is unknown\n"
					];

					throw new Error(message.join(""));
				}
			});
		} else {
			throw new Error("Environment must be an object");
		}
	}
850246
protected function checkEnvVariable()
    {
        $key = $this->checkKey();
        $output = $this->execSSH("cd $this->domain;cat .env");
        if (str_contains($output, $key)) {
            $this->info("Key $key found in remote environment file");
        } else {
            $this->error("Key $key NOT found in remote environment file");
        }
    }
1339201
protected function checkEnvironmentPath() {
		// Create folder if it doesn't exist
		$configDir = dirname($this->getConfigFilename());
		if(!file_exists($configDir) && $configDir) {
			mkdir($configDir, 0777, true);
		}
	}
736435
private Environment checkSkip(Stmt.Skip stmt, Environment environment, EnclosingScope scope) {
		return environment;
	}
959792
protected function _getEnvironment()
    {
        $environment = self::$forceEnvironment;

        // Check if the environment has been manually set (forced).
        if ($environment !== null) {
            if (!isset($this->_environments[$environment])) {
                throw new Exception('Environment configuration for "' . $environment . '" could not be found.');
            }
        }
        // If no manual setting is available, use "host:port" to decide which config to use.
        if ($environment === null && !empty($_SERVER['HTTP_HOST'])) {
            $host = (string)$_SERVER['HTTP_HOST'];
            foreach ($this->_environments as $env => $envConfig) {
                if (isset($envConfig['domain']) && in_array($host, $envConfig['domain'])) {
                    $environment = $env;
                    break;
                }
            }
        }
        // If there is no host:port match, try "host" only.
        if ($environment === null && !empty($_SERVER['SERVER_NAME'])) {
            $host = (string)$_SERVER['SERVER_NAME'];
            foreach ($this->_environments as $env => $envConfig) {
                if (isset($envConfig['domain']) && in_array($host, $envConfig['domain'])) {
                    $environment = $env;
                    break;
                }
            }
        }
        // If no host matched then try to use the APP path.
        if ($environment === null && ($serverPath = $this->_getRealAppPath())) {
            foreach ($this->_environments as $env => $envConfig) {
                if (isset($envConfig['path']) && in_array($serverPath, $envConfig['path'])) {
                    $environment = $env;
                    break;
                }
            }
        }
        // No environment could be identified -> we are on a dev machine.
        if (!$environment) {
            $environment = 'local';
        }

        return $environment;
    }
302856
public static function environment()
	{
		$env = static::fw()->config->get( 'app.env', 'production' );

		if ( func_num_args() > 0 )
		{
			$patterns = is_array( func_get_arg( 0 ) ) ? func_get_arg( 0 ) : func_get_args();

			foreach ( $patterns as $pattern )
				if ( Str::is( $pattern, $env ) )
					return true;

			return false;
		}

		return $env;
	}
51766
function isEnv(envAlias) {
  // Check for default case
  if (envAlias === ENV_ALIAS.DEV && Object.keys(env).length === 0) {
    return true;
  }

  return envAlias.some(alias => env[alias]);
}
150631
protected function currentEnvironment($environment = null, $default = 'development')
    {
        $current = ($environment === null) ? $default : $environment;
        if (empty($environment)) {
            foreach ($this->environments as $name => $config) {
                if ($this->_match($name, $config['params'])) {
                    $current = $name;
                    break;
                }
            }
        }

        return $current;
    }
655437
def echo_detected_environment(env_name, env_vars):
    """"""
    env_override_name = 'DEPLOY_ENVIRONMENT'
    LOGGER.info("")
    if env_override_name in env_vars:
        LOGGER.info("Environment \"%s\" was determined from the %s environment variable.",
                    env_name,
                    env_override_name)
        LOGGER.info("If this is not correct, update "
                    "the value (or unset it to fall back to the name of "
                    "the current git branch or parent directory).")
    else:
        LOGGER.info("Environment \"%s\" was determined from the current "
                    "git branch or parent directory.",
                    env_name)
        LOGGER.info("If this is not the environment name, update the branch/folder name or "
                    "set an override value via the %s environment variable",
                    env_override_name)
    LOGGER.info("")
592585
public function isEnvironnement($nameEnv)
    {
        $authority = $this->request->getUri()->getAuthority();

        return isset($this->environnement[ $nameEnv ]) && (
            in_array(gethostname(), $this->environnement[ $nameEnv ]) ||
            in_array($authority, $this->environnement[ $nameEnv ])
            );
    }
900103
private static function checkEnvironment()
    {
        list($major, $minor) = explode('.', PHP_VERSION);

        if ((int) $major < 5 || ((int) $major === 5 && (int) $minor < 6)) {
            throw new ClientException('Incompatible PHP environment. Expecting PHP 5.6 or higher');
        }
    }
962786
protected function detectConsoleEnvironment($environments, array $args)
    {
        // First we will check if an environment argument was passed via console arguments
        // and if it was that automatically overrides as the environment. Otherwise, we
        // will check the environment as a "web" request like a typical HTTP request.
        if (!is_null($value = $this->getEnvironmentArgument($args))) {
            return head(array_slice(explode('=', $value), 1));
        }
    }
1054254
private static function environment() {
	$environment = getenv('APP_ENV') ?: 'production';
	
	define('alsvanzelf\fem\ENVIRONMENT',  $environment);
	define('alsvanzelf\fem\ROOT_DIR',     realpath(__DIR__.'/../../../../').'/');
	define('alsvanzelf\fem\ROOT_DIR_APP', \alsvanzelf\fem\ROOT_DIR.'application/');
	define('alsvanzelf\fem\CLI',          (strpos(php_sapi_name(), 'cli') !== false || defined('STDIN')));
	
	if (constant('\alsvanzelf\fem\ENVIRONMENT') == false) {
		echo 'no environment set';
		exit;
	}
}
839134
public function whenEnvironmentIs()
    {
        $environments = func_get_args();

        $appEnvironment = $this->appEnvironment;

        return $this->when(function($asset) use ($environments, $appEnvironment)
        {
            return in_array($appEnvironment, $environments);
        });
    }