<?php

/**
 * @package     Dotclear
 *
 * @copyright   Olivier Meunier & Association Dotclear
 * @copyright   AGPL-3.0
 */
declare(strict_types=1);

namespace Dotclear\Plugin\antispam;

/**
 * @brief   The module REST service handler.
 * @ingroup antispam
 */
class Rest
{
    /**
     * Gets the spams count. (JSON)
     *
     * @return  array<string, mixed>   The spams count message
     */
    public static function getSpamsCount(): array
    {
        $count = Antispam::countSpam();
        $str   = $count > 0 ? sprintf(__('(including one spam comment)', '(including %d spam comments)', $count), $count) : '';

        return [
            'ret' => $str,
        ];
    }
}
