@@ -283,9 +283,9 @@ discard block |
||
283 | 283 | } |
284 | 284 | |
285 | 285 | return $api ? [ |
286 | - 'sensitive' => $generator['sensitive'], |
|
287 | - 'key' => $generator['key'], |
|
288 | - 'img' => $this->image->encode('data-url')->encoded |
|
286 | + 'sensitive' => $generator['sensitive'], |
|
287 | + 'key' => $generator['key'], |
|
288 | + 'img' => $this->image->encode('data-url')->encoded |
|
289 | 289 | ] : $this->image->response('png', $this->quality); |
290 | 290 | } |
291 | 291 | |
@@ -319,7 +319,7 @@ discard block |
||
319 | 319 | $key .= ''; |
320 | 320 | } else { |
321 | 321 | for ($i = 0; $i < $this->length; $i++) { |
322 | - $char = $characters[rand(0, count($characters) - 1)]; |
|
322 | + $char = $characters[rand(0, count($characters) - 1)]; |
|
323 | 323 | $bag[] = $this->sensitive ? $char : $this->str->lower($char); |
324 | 324 | } |
325 | 325 | $key = implode('', $bag); |
@@ -332,9 +332,9 @@ discard block |
||
332 | 332 | ]); |
333 | 333 | |
334 | 334 | return [ |
335 | - 'value' => $bag, |
|
336 | - 'sensitive' => $this->sensitive, |
|
337 | - 'key' => $hash |
|
335 | + 'value' => $bag, |
|
336 | + 'sensitive' => $this->sensitive, |
|
337 | + 'key' => $hash |
|
338 | 338 | ]; |
339 | 339 | } |
340 | 340 | |
@@ -343,10 +343,10 @@ discard block |
||
343 | 343 | */ |
344 | 344 | protected function text() |
345 | 345 | { |
346 | - $marginTop = $this->image->height() / $this->length; |
|
346 | + $marginTop = $this->image->height() / $this->length; |
|
347 | 347 | |
348 | - $text = $this->text; |
|
349 | - if (is_string($text)) { |
|
348 | + $text = $this->text; |
|
349 | + if (is_string($text)) { |
|
350 | 350 | $text = str_split($text); |
351 | 351 | } |
352 | 352 | |
@@ -435,26 +435,26 @@ discard block |
||
435 | 435 | return $this->image; |
436 | 436 | } |
437 | 437 | |
438 | - /** |
|
439 | - * Captcha check |
|
440 | - * |
|
441 | - * @param $value |
|
442 | - * @return bool |
|
443 | - */ |
|
444 | - public function check($value) |
|
445 | - { |
|
446 | - if ( ! $this->session->has('captcha')) |
|
447 | - { |
|
448 | - return false; |
|
449 | - } |
|
438 | + /** |
|
439 | + * Captcha check |
|
440 | + * |
|
441 | + * @param $value |
|
442 | + * @return bool |
|
443 | + */ |
|
444 | + public function check($value) |
|
445 | + { |
|
446 | + if ( ! $this->session->has('captcha')) |
|
447 | + { |
|
448 | + return false; |
|
449 | + } |
|
450 | 450 | |
451 | - $key = $this->session->get('captcha.key'); |
|
452 | - $sensitive = $this->session->get('captcha.sensitive'); |
|
451 | + $key = $this->session->get('captcha.key'); |
|
452 | + $sensitive = $this->session->get('captcha.sensitive'); |
|
453 | 453 | |
454 | - if ( ! $sensitive) |
|
455 | - { |
|
456 | - $value = $this->str->lower($value); |
|
457 | - } |
|
454 | + if ( ! $sensitive) |
|
455 | + { |
|
456 | + $value = $this->str->lower($value); |
|
457 | + } |
|
458 | 458 | |
459 | 459 | |
460 | 460 | $res = $this->hasher->check($value, $key); |
@@ -464,18 +464,18 @@ discard block |
||
464 | 464 | } |
465 | 465 | |
466 | 466 | return $res; |
467 | - } |
|
468 | - |
|
469 | - /** |
|
470 | - * Captcha check |
|
471 | - * |
|
472 | - * @param $value |
|
473 | - * @return bool |
|
474 | - */ |
|
475 | - public function check_api($value, $key) |
|
476 | - { |
|
477 | - return $this->hasher->check($value, $key); |
|
478 | - } |
|
467 | + } |
|
468 | + |
|
469 | + /** |
|
470 | + * Captcha check |
|
471 | + * |
|
472 | + * @param $value |
|
473 | + * @return bool |
|
474 | + */ |
|
475 | + public function check_api($value, $key) |
|
476 | + { |
|
477 | + return $this->hasher->check($value, $key); |
|
478 | + } |
|
479 | 479 | |
480 | 480 | /** |
481 | 481 | * Generate captcha image source |