25 lines
916 B
PHP
25 lines
916 B
PHP
<?php
|
|
|
|
namespace App\Contracts\Moderation;
|
|
|
|
interface ModerationRuleInterface
|
|
{
|
|
/**
|
|
* Analyze the given content and return an array of findings.
|
|
*
|
|
* Each finding is an associative array with:
|
|
* - 'rule' => string (rule identifier)
|
|
* - 'score' => int (score contribution)
|
|
* - 'reason' => string (human-readable reason)
|
|
* - 'links' => array (matched URLs, if any)
|
|
* - 'domains' => array (matched domains, if any)
|
|
* - 'keywords' => array (matched keywords, if any)
|
|
*
|
|
* @param string $content The raw text content to analyze
|
|
* @param string $normalized Lowercase/trimmed version for matching
|
|
* @param array $context Optional metadata (user_id, artwork_id, content_type, etc.)
|
|
* @return array<int, array>
|
|
*/
|
|
public function analyze(string $content, string $normalized, array $context = []): array;
|
|
}
|