HEX
Server: Apache
System: Linux WWW 6.1.0-40-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.153-1 (2025-09-20) x86_64
User: web11 (1011)
PHP: 8.2.29
Disabled: NONE
Upload Files
File: /var/www/intranet.kauko.lt/wp-content/plugins/wise-chat/src/services/user/WiseChatAbuses.php
<?php

/**
 * Wise Chat user abuses
 */
class WiseChatAbuses {
    const PROPERTY_NAME = 'ban_detector_counter';

    /**
     * @var WiseChatUserService
     */
    private $userService;

    /**
     * WiseChatAbuses constructor.
     */
    public function __construct() {
        $this->userService = WiseChatContainer::get('services/user/WiseChatUserService');
    }

    /**
     * Increments and returns the abuses counter.
     *
     * @return integer
     */
    public function incrementAndGetAbusesCounter() {
        $counter = $this->userService->getProperty(self::PROPERTY_NAME);
        if ($counter === null) {
            $counter = 0;
        }
        $counter++;

        $this->userService->setProperty(self::PROPERTY_NAME, $counter);

        return $counter;
    }

    /**
     * Clears the abuses counter.
     *
     * @return null
     */
    public function clearAbusesCounter() {
        $this->userService->setProperty(self::PROPERTY_NAME, 0);
    }
}