Conditions | 5 |
Paths | 2 |
Total Lines | 17 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Tests | 0 |
CRAP Score | 30 |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
93 | public function isValid(ServerRequestInterface $request): bool |
||
94 | { |
||
95 | $response = Request::var($request, $this->reCaptcha); |
||
96 | |||
97 | $url = static::URL . "?secret={$this->secret}&response={$response}"; |
||
98 | |||
99 | $status = json_decode(file_get_contents($url), true); |
||
100 | |||
101 | if ( |
||
102 | true === $status['success'] |
||
103 | && $status['score'] >= $this->minScore |
||
104 | && ($status['action'] == $this->action || empty($this->action)) |
||
105 | ) { |
||
106 | return true; |
||
107 | } |
||
108 | |||
109 | return false; |
||
110 | } |
||
112 |