| Total Complexity | 4 |
| Total Lines | 30 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 11 | class ReCaptcha |
||
| 12 | { |
||
| 13 | public static $siteKey = ''; |
||
| 14 | public static $secretKey = ''; |
||
| 15 | |||
| 16 | /** |
||
| 17 | * Retorna TRUE se usuário marcou "Não sou um robô" |
||
| 18 | * @return bool |
||
| 19 | */ |
||
| 20 | public static function isValid() |
||
| 21 | { |
||
| 22 | if (static::$siteKey && static::$secretKey) { |
||
| 23 | $response = json_decode(file_get_contents(static::getValidationUrl()), true); |
||
| 24 | |||
| 25 | return (bool) $response['success']; |
||
| 26 | } else { |
||
| 27 | return true; |
||
| 28 | } |
||
| 29 | } |
||
| 30 | |||
| 31 | /** |
||
| 32 | * Retorna a URL de validação |
||
| 33 | * @return string |
||
| 34 | */ |
||
| 35 | private static function getValidationUrl() |
||
| 41 | } |
||
| 42 | } |
||
| 43 |