PHP Class ManaPHP\Security\Captcha

Inheritance: extends ManaPHP\Component, implements ManaPHP\Security\CaptchaInterface
Show file Open project: manaphp/manaphp

Protected Properties

Property Type Description
$_angleAmplitude integer
$_bgRGB string
$_charset string
$_fonts array
$_length integer
$_minInterval integer
$_noiseCharCount integer
$_sessionVar string

Public Methods

Method Description
__construct ( array | Captcha $options = [] ) Captcha constructor.
generate ( integer $width = 100, integer $height = 30, integer $ttl = 300 ) : ManaPHP\Http\ResponseInterface
setNoiseCharCount ( integer $count ) : static
tryVerify ( string $code ) : void
verify ( string $code ) : void

Protected Methods

Method Description
_generateByGd ( string $code, integer $width, integer $height ) : string
_generateByImagic ( string $code, integer $width, integer $height ) : ManaPHP\Http\ResponseInterface
_rand_amplitude ( float $a ) : float
_verify ( string $code, boolean $isTry ) : void

Method Details

__construct() public method

Captcha constructor.
public __construct ( array | Captcha $options = [] )
$options array | ConfManaPHP\Security\Captcha

_generateByGd() protected method

protected _generateByGd ( string $code, integer $width, integer $height ) : string
$code string
$width integer
$height integer
return string

_generateByImagic() protected method

protected _generateByImagic ( string $code, integer $width, integer $height ) : ManaPHP\Http\ResponseInterface
$code string
$width integer
$height integer
return ManaPHP\Http\ResponseInterface

_rand_amplitude() protected method

protected _rand_amplitude ( float $a ) : float
$a float
return float

_verify() protected method

protected _verify ( string $code, boolean $isTry ) : void
$code string
$isTry boolean
return void

generate() public method

public generate ( integer $width = 100, integer $height = 30, integer $ttl = 300 ) : ManaPHP\Http\ResponseInterface
$width integer
$height integer
$ttl integer
return ManaPHP\Http\ResponseInterface

setNoiseCharCount() public method

public setNoiseCharCount ( integer $count ) : static
$count integer
return static

tryVerify() public method

public tryVerify ( string $code ) : void
$code string
return void

verify() public method

public verify ( string $code ) : void
$code string
return void

Property Details

$_angleAmplitude protected property

protected int $_angleAmplitude
return integer

$_bgRGB protected property

protected string $_bgRGB
return string

$_charset protected property

protected string $_charset
return string

$_fonts protected property

protected array $_fonts
return array

$_length protected property

protected int $_length
return integer

$_minInterval protected property

protected int $_minInterval
return integer

$_noiseCharCount protected property

protected int $_noiseCharCount
return integer

$_sessionVar protected property

protected string $_sessionVar
return string