Optimize formatting for Symfony coding standards
This commit is contained in:
parent
9fc82c8453
commit
fef3e306fd
|
@ -139,17 +139,16 @@ class CaptchaGenerator
|
|||
$size = $width / strlen($captchaValue);
|
||||
$font = $options['font'];
|
||||
$box = imagettfbbox($size, 0, $font, $captchaValue);
|
||||
$txt_width = $box[2] - $box[0];
|
||||
$txt_height = $box[1] - $box[7];
|
||||
$textWidth = $box[2] - $box[0];
|
||||
$textHeight = $box[1] - $box[7];
|
||||
|
||||
imagettftext($i, $size, 0, ($width-$txt_width)/2, ($height-$txt_height)/2+$size, $col, $font, $captchaValue);
|
||||
imagettftext($i, $size, 0, ($width - $textWidth) / 2, ($height - $textHeight) / 2 + $size, $col, $font, $captchaValue);
|
||||
|
||||
// Distort the image
|
||||
$X = $this->rand(0, $width);
|
||||
$Y = $this->rand(0, $height);
|
||||
$Phase=$this->rand(0,10);
|
||||
$Scale = 1.3 + $this->rand(0,10000)/30000;
|
||||
$Amp=1+$this->rand(0,1000)/1000;
|
||||
$phase = $this->rand(0, 10);
|
||||
$scale = 1.3 + $this->rand(0, 10000) / 30000;
|
||||
$out = imagecreatetruecolor($width, $height);
|
||||
|
||||
for ($x = 0; $x < $width; $x++) {
|
||||
|
@ -166,7 +165,7 @@ class CaptchaGenerator
|
|||
$nX = $X;
|
||||
$nY = $Y;
|
||||
}
|
||||
$nY = $nY+$Scale*sin($Phase + $nX*0.2);
|
||||
$nY = $nY + $scale * sin($phase + $nX * 0.2);
|
||||
|
||||
$p = $this->bilinearInterpolate($nX - floor($nX), $nY - floor($nY),
|
||||
$this->getCol($i, floor($nX), floor($nY)),
|
||||
|
|
|
@ -57,8 +57,7 @@ class CaptchaValidator
|
|||
$code = $form->getData();
|
||||
$expectedCode = $this->getExpectedCode();
|
||||
|
||||
if (!($code && is_string($code)
|
||||
&& ($this->compare($code, $expectedCode) || $this->compare($code, $this->bypassCode)))) {
|
||||
if (!($code && is_string($code) && ($this->compare($code, $expectedCode) || $this->compare($code, $this->bypassCode)))) {
|
||||
$form->addError(new FormError($this->invalidMessage));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue