<commit_before><?php

class SV_IgnoreUserLimit_XenForo_Model_UserIgnore extends XFCP_SV_IgnoreUserLimit_XenForo_Model_UserIgnore
{
    /**
     * @param int $userId
     * @return int
     */
    public function getIgnoredUserCount($userId)
    {
        $count = $this->_getDb()->fetchOne('
            SELECT count(user_id)
            FROM xf_user_ignored
            WHERE user_id = ?
        ', $userId);

        return $count ? $count : 0;
    }

    public function ignoreUsers($userId, $ignoredUserIds)
    {
        $ignoreLimit = -1;
        $visitor = XenForo_Visitor::getInstance();
        if ($userId == $visitor->getUserId())
        {
            $ignoreLimit = $visitor->hasPermission('general', 'sv_userIgnoreLimit');

            if ($visitor->hasPermission('general', 'sv_userIgnoreDisabled'))
            {
                throw new XenForo_Exception(new XenForo_Phrase('sv_you_may_only_ignore_x_people', array('count' => 0)), true);
            }
        }

        if ($ignoreLimit >= 0)
        {
            $ignoreCount = $this->getIgnoredUserCount($userId) + is_array($ignoredUserIds) ? count($ignoredUserIds) : 0;
            if ($ignoreCount > $ignoreLimit)
            {
                throw new XenForo_Exception(new XenForo_Phrase('sv_you_may_only_ignore_x_people', array('count' => $ignoreLimit)), true);
            }
        }

        return parent::ignoreUsers($userId, $ignoredUserIds);
    }

    public function canIgnoreUser($userId, array $user, &$error = '')
    {
        $setError = (func_num_args() >= 3);

        $visitor = XenForo_Visitor::getInstance();
        if ($visitor->hasPermission('general', 'sv_userIgnoreDisabled'))
        {
            if ($setError)<commit_msg>php 7.2 fixes take #2<commit_after><?php

class SV_IgnoreUserLimit_XenForo_Model_UserIgnore extends XFCP_SV_IgnoreUserLimit_XenForo_Model_UserIgnore
{
    /**
     * @param int $userId
     * @return int
     */
    public function getIgnoredUserCount($userId)
    {
        $count = $this->_getDb()->fetchOne('
            SELECT count(user_id)
            FROM xf_user_ignored
            WHERE user_id = ?
        ', $userId);

        return $count ? $count : 0;
    }

    public function ignoreUsers($userId, $ignoredUserIds)
    {
        $ignoreLimit = -1;
        $visitor = XenForo_Visitor::getInstance();
        if ($userId == $visitor->getUserId())
        {
            $ignoreLimit = $visitor->hasPermission('general', 'sv_userIgnoreLimit');

            if ($visitor->hasPermission('general', 'sv_userIgnoreDisabled'))
            {
                throw new XenForo_Exception(new XenForo_Phrase('sv_you_may_only_ignore_x_people', array('count' => 0)), true);
            }
        }

        if ($ignoreLimit >= 0)
        {
            $ignoreCount = $this->getIgnoredUserCount($userId) + (is_array($ignoredUserIds) ? count($ignoredUserIds) : 1);
            if ($ignoreCount > $ignoreLimit)
            {
                throw new XenForo_Exception(new XenForo_Phrase('sv_you_may_only_ignore_x_people', array('count' => $ignoreLimit)), true);
            }
        }

        return parent::ignoreUsers($userId, $ignoredUserIds);
    }

    public function canIgnoreUser($userId, array $user, &$error = '')
    {
        $setError = (func_num_args() >= 3);

        $visitor = XenForo_Visitor::getInstance();
        if ($visitor->hasPermission('general', 'sv_userIgnoreDisabled'))
        {
            if ($setError)
{'fraction_non_alphanumeric': 0.12702078521939955, 'fraction_numerical': 0.0043302540415704385, 'mean_word_length': 2.4375, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 27, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1791276', 'n_tokens_mistral': 1069, 'n_tokens_neox': 1037, 'n_words': 177}