Cant pass additional extraData to user spam checker from user registration service

Kirby

Well-known member
Affected version
2.3.6
PHP:
public function checkForSpam()
{
    $user = $this->user;

    $userChecker = $this->app->spam()->userChecker();
    $userChecker->check($user, ['preRegActionKey' => $this->preRegActionKey]);

As can be seen, $extraData is kinda hardcoded which makes it somewaht difficult to pass additonal data to user checkers without overwriting the whole method.

Could this be changed to smth. like
PHP:
protected function getSpamCheckExtraData(): array
{
    return ['preRegActionKey' => $this->preRegActionKey];
}

public function checkForSpam()
{
    $user = $this->user;

    $userChecker = $this->app->spam()->userChecker();
    $userChecker->check($user, $this->getSpamCheckExtraData());
?

This would allow extending the class to easily pass additional data in a clean way.
 
Back
Top Bottom