-
-
Save trikitrok/76c9082ae1a3add22e0695f92a658cbc to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| namespace Trovit\B2B\AdClick\Domain; | |
| class ClickValidation | |
| { | |
| private $botClickDetector; | |
| private $domainLogger; | |
| private $paramsValidator; | |
| public function __construct( | |
| BotClickDetector $botClickDetector, | |
| DomainLogger $domainLogger, | |
| ClickParamsValidator $paramsValidator | |
| ) | |
| { | |
| $this->botClickDetector = $botClickDetector; | |
| $this->domainLogger = $domainLogger; | |
| $this->paramsValidator = $paramsValidator; | |
| } | |
| public function isValid(array $click) | |
| { | |
| if (!$this->paramsValidator->isValid($click)) { | |
| return false; | |
| } | |
| $isBotClick = $this->botClickDetector->isBot($click['userIp']); | |
| if ($isBotClick) { | |
| $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