| Total Complexity | 4 |
| Total Lines | 25 |
| Duplicated Lines | 0 % |
| Coverage | 100% |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 11 | class ReCaptchaPolicy implements ServerRequestPolicyInterface |
||
| 12 | { |
||
| 13 | protected string $response; |
||
| 14 | |||
| 15 | protected ReCaptcha $reCaptcha; |
||
| 16 | |||
| 17 | 9 | public function __construct(string $response, ReCaptcha $reCaptcha) |
|
| 18 | { |
||
| 19 | 9 | $this->response = $response; |
|
| 20 | 9 | $this->reCaptcha = $reCaptcha; |
|
| 21 | } |
||
| 22 | |||
| 23 | 6 | public function approvesRequest(ServerRequestInterface $request): bool |
|
| 26 | } |
||
| 27 | |||
| 28 | 6 | protected function getApiResponse(ServerRequestInterface $request): Response |
|
| 29 | { |
||
| 30 | 6 | return $this->reCaptcha->verify($this->getGeneratedResponse($request)); |
|
| 31 | } |
||
| 32 | |||
| 33 | 6 | protected function getGeneratedResponse(ServerRequestInterface $request): string |
|
| 36 | } |
||
| 37 | } |
||
| 38 |