private function validateUser($user, $requireValue = false)
    {
        // If we're passed something falsy, just return null
        if (!$user && !$requireValue) {
            return null;
        }

        // If we have a known supported type, resolve the id and return it
        if ($user instanceof User || $user instanceof UserInfo) {
            return (int) $user->getUserID();
        }

        // If what we're left with is numeric, return it as an int
        if (is_numeric($user)) {
            return (int) $user;
        }

        throw new \InvalidArgumentException('Invalid user value passed, must be User instance or int');
    }