SpamDetectionMiddleware
extends AbstractMiddleware
in package
Table of Contents
- $suspiciousKeywords : mixed
- process() : ResponseInterface
- Process an incoming server request.
- log() : LoggerInterface
- multiMerge() : array<string|int, mixed>
- Merges two multi-dimensional arrays recursively.
- toString() : bool
- when() : void
- blockRequest() : ResponseInterface
- containsCyrillicCharacters() : bool
- containsMixedLanguagePhrases() : bool
- containsSuspiciousKeywords() : bool
Properties
$suspiciousKeywords
private
mixed
$suspiciousKeywords
= ['вход', 'кракен', 'Kraken']
Methods
process()
Process an incoming server request.
public
process(ServerRequestInterface $request, RequestHandlerInterface $handler) : ResponseInterface
Parameters
- $request : ServerRequestInterface
- $handler : RequestHandlerInterface
Return values
ResponseInterface —log()
protected
log() : LoggerInterface
Return values
LoggerInterface —multiMerge()
Merges two multi-dimensional arrays recursively.
protected
static multiMerge(array<string|int, mixed> $array1, array<string|int, mixed> $array2) : array<string|int, mixed>
This function will recursively merge the values of $array2
into $array1
.
If the same key exists in both arrays, and both corresponding values are arrays,
the values are recursively merged.
Otherwise, values from $array2
will overwrite those in $array1
.
Parameters
- $array1 : array<string|int, mixed>
-
The base array that will be merged into.
- $array2 : array<string|int, mixed>
-
The array with values to merge into
$array1
.
Return values
array<string|int, mixed> —The merged array.
toString()
protected
static toString(array<string|int, mixed>|string $array) : bool
Parameters
- $array : array<string|int, mixed>|string
Return values
bool —when()
protected
when() : void
Return values
void —blockRequest()
private
blockRequest(string $message) : ResponseInterface
Parameters
- $message : string
Return values
ResponseInterface —containsCyrillicCharacters()
private
containsCyrillicCharacters(string $content) : bool
Parameters
- $content : string
Return values
bool —containsMixedLanguagePhrases()
private
containsMixedLanguagePhrases(string $content) : bool
Parameters
- $content : string
Return values
bool —containsSuspiciousKeywords()
private
containsSuspiciousKeywords(string $content) : bool
Parameters
- $content : string