1 | <?php |
||
8 | class NoCaptchaService extends AbstractService |
||
9 | { |
||
10 | const API_SERVER = 'https://www.google.com/recaptcha/api'; |
||
11 | const VERIFY_SERVER = 'https://www.google.com/recaptcha/api/siteverify'; |
||
12 | const CACERT_PATH = __DIR__ . '/../../ssl/cacert.pem'; |
||
13 | |||
14 | /** |
||
15 | * @var string |
||
16 | */ |
||
17 | protected $ip; |
||
18 | |||
19 | /** |
||
20 | * @var array |
||
21 | */ |
||
22 | protected $params = [ |
||
23 | 'onload' => null, |
||
24 | 'render' => null, |
||
25 | 'hl' => null, |
||
26 | ]; |
||
27 | |||
28 | /** |
||
29 | * |
||
30 | * @var HttpClient |
||
31 | */ |
||
32 | protected $httpClient; |
||
33 | |||
34 | /** |
||
35 | * @param array|Traversable $options |
||
36 | */ |
||
37 | public function __construct($options = []) |
||
41 | |||
42 | /** |
||
43 | * @return string |
||
44 | */ |
||
45 | public function getServiceUri() |
||
49 | |||
50 | /** |
||
51 | * @return HttpClient |
||
52 | */ |
||
53 | public function getHttpClient() |
||
60 | |||
61 | /** |
||
62 | * @param array|Traversable|HttpClient $httpClient |
||
63 | * @return NoCaptchaService |
||
64 | */ |
||
65 | public function setHttpClient($httpClient) |
||
94 | |||
95 | /** |
||
96 | * @return string |
||
97 | */ |
||
98 | public function getIp() |
||
102 | |||
103 | /** |
||
104 | * @param string $ip |
||
105 | * @return NoCaptchaService |
||
106 | */ |
||
107 | public function setIp($ip) |
||
112 | |||
113 | /** |
||
114 | * @param array $params |
||
115 | * @return NoCaptchaService |
||
116 | */ |
||
117 | public function setParams(array $params) |
||
126 | |||
127 | /** |
||
128 | * @param array|Traversable $options |
||
129 | * @throws Exception\InvalidArgumentException |
||
130 | * @return NoCaptchaService |
||
131 | */ |
||
132 | public function setOptions($options = []) |
||
147 | |||
148 | /** |
||
149 | * @param string $responseField |
||
150 | * @return \Zend\Http\Response |
||
151 | */ |
||
152 | protected function post($responseField) |
||
177 | |||
178 | /** |
||
179 | * @param string $value |
||
180 | * @return \ReCaptcha2\Captcha\Result |
||
181 | */ |
||
182 | public function verify($value) |
||
187 | } |
||
188 |