original_string: 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;
      }
code: 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;
      }
code_tokens: 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 ; }
docstring: get Env Name By Host
  @param null|string $hostname
  @param string $defaultEnv
  @return string
docstring_tokens: get Env Name By Host