src/Components/EnvDetector.php
public static function getEnvNameByHost(string $defaultEnv = null, string $hostname = null): string
    {
        $hostname = $hostname ?: gethostname();

        if (!$hostname) {
            return $defaultEnv;
        }

        foreach (self::$host2env as $kw => $env) {
            if (false !== strpos($hostname, $kw)) {
                return $env;
            }
        }

        return $defaultEnv;
    }
public static function getEnvNameByHost(string $defaultEnv = null, string $hostname = null): string
    {
        $hostname = $hostname ?: gethostname();

        if (!$hostname) {
            return $defaultEnv;
        }

        foreach (self::$host2env as $kw => $env) {
            if (false !== strpos($hostname, $kw)) {
                return $env;
            }
        }

        return $defaultEnv;
    }
public static function getEnvNameByHost ( string $ defaultEnv = null , string $ hostname = null ) : string { $ hostname = $ hostname ? : gethostname ( ) ; if ( ! $ hostname ) { return $ defaultEnv ; } foreach ( self :: $ host2env as $ kw => $ env ) { if ( false !== strpos ( $ hostname , $ kw ) ) { return $ env ; } } return $ defaultEnv ; }
get Env Name By Host
@param null|string $hostname
@param string $defaultEnv
@return string
get Env Name By Host