public static function env(string $variable = null, $default = null)
    {
        // If there was no variable requested
        if (null === $variable) {
            // Return the env class
            return static::getEnv();
        }

        // If the env has this variable defined and the variable isn't null
        if (
            \defined(static::getEnv() . '::' . $variable)
            && null !== $env = \constant(static::getEnv() . '::' . $variable)
        ) {
            // Return the variable
            return $env;
        }

        // Otherwise return the default
        return $default;
    }
public static function env(string $variable = null, $default = null)
    {
        // If there was no variable requested
        if (null === $variable) {
            // Return the env class
            return static::getEnv();
        }

        // If the env has this variable defined and the variable isn't null
        if (
            \defined(static::getEnv() . '::' . $variable)
            && null !== $env = \constant(static::getEnv() . '::' . $variable)
        ) {
            // Return the variable
            return $env;
        }

        // Otherwise return the default
        return $default;
    }
public static function env ( string $ variable = null , $ default = null ) { // If there was no variable requested if ( null === $ variable ) { // Return the env class return static :: getEnv ( ) ; } // If the env has this variable defined and the variable isn't null if ( \ defined ( static :: getEnv ( ) . '::' . $ variable ) && null !== $ env = \ constant ( static :: getEnv ( ) . '::' . $ variable ) ) { // Return the variable return $ env ; } // Otherwise return the default return $ default ; }
Get an environment variable.

@param string $variable [optional] The variable to get
@param string $default  [optional] The default value to return

@return mixed|\Valkyrja\Env\Env||config|Env
Get an environment variable .