protected function sessionEnvironment()
    {
        // Check isDev in querystring
        if (isset($_GET['isDev'])) {
            if (isset($_SESSION)) {
                unset($_SESSION['isTest']); // In case we are changing from test mode
                $_SESSION['isDev'] = $_GET['isDev'];
            }
            return self::DEV;
        }

        // Check isTest in querystring
        if (isset($_GET['isTest'])) {
            if (isset($_SESSION)) {
                unset($_SESSION['isDev']); // In case we are changing from dev mode
                $_SESSION['isTest'] = $_GET['isTest'];
            }
            return self::TEST;
        }

        // Check session
        if (!empty($_SESSION['isDev'])) {
            return self::DEV;
        }
        if (!empty($_SESSION['isTest'])) {
            return self::TEST;
        }

        // no session environment
        return null;
    }