public
    static function getEnvironment()
    {
        if (empty(self::$environment)) {
            self::$environment = getenv(self::ENV)
                ?: @$_SERVER[self::ENV]
                    ?: @$_ENV[self::ENV];

            // If the environment cannot be inferred, assume production.
            if (empty(self::$environment)) {
                self::$environment = self::ENV_PRODUCTION;
            }
        }

        return self::$environment;
    }