Skip to content

Instantly share code, notes, and snippets.

@trikitrok
Last active June 30, 2019 20:40
Show Gist options
  • Select an option

  • Save trikitrok/c4a928f6f7420a339240f0f52fe4f8b1 to your computer and use it in GitHub Desktop.

Select an option

Save trikitrok/c4a928f6f7420a339240f0f52fe4f8b1 to your computer and use it in GitHub Desktop.
<?php
namespace Trovit\B2B\AdClick\Domain;
class NoBotClickValidator implements ClickValidator
{
private $botClickDetector;
private $domainLogger;
public function __construct(
BotClickDetector $botClickDetector,
DomainLogger $domainLogger
)
{
$this->botClickDetector = $botClickDetector;
$this->domainLogger = $domainLogger;
}
public function isValid(array $click)
{
$clickMadeByBot = $this->botClickDetector->isBot($click['userIp']);
if ($clickMadeByBot) {
$this->domainLogger->logBotClick($click);
return false;
}
return true;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment