====== ResponsiveCaptcha ======
**Layer:** ''Core'' · **Source:** ''lib/core/ResponsiveCaptcha.php:17'' (lines 17–645)
----
class ResponsiveCaptcha
Generate random text-based CAPTCHAs with simple arithmetic and logic questions
Website: https://github.com/theodorejb/responsive-Captcha
Updated: 2013-08-01
======= Docblock Metadata =======
^ Tag ^ Value ^
| ''@author'' | Theodore Brown |
| ''@version'' | 1.0.1 |
======= Inheritance =======
//No parent, interface or trait. This is a root type.//
======= Constants (0) =======
//None.//
======= Properties (1) =======
^ Visibility ^ Type ^ Name ^ Default ^ Line ^
| ''private'' | ''(untyped)'' | ''$sessionVariableName'' | ''"ResponsiveCaptchaAnswer"'' | 19 |
======= Methods (12) =======
^ Visibility ^ Method ^ Summary ^ Line ^
| public | ''__construct()'' | (undocumented) | 21 |
| public | ''checkAnswer()'' | Checks whether a user's response matches the stored answer | 43 |
| public | ''getNewQuestion()'' | Generate a random question string and store the answer in the session | 77 |
| private | ''getAdditionProblem()'' | Returns a random addition problem after adding the answer to the session | 124 |
| private | ''getSubtractionProblem()'' | Returns a random subtraction problem | 164 |
| private | ''getMultiplicationProblem()'' | Returns a random multiplication problem | 208 |
| private | ''getDivisionProblem()'' | Returns a random division problem | 248 |
| private | ''getLetterProblem()'' | Get a random letter position question | 278 |
| private | ''getNumberProblem()'' | For a range of three unique numbers, ask which one is largest or smallest | 426 |
| private | ''getWordFromNumber()'' | Returns the name of any integer less than or equal to 100 | 484 |
| private | ''storeAnswer()'' | Store an answer in the session | 598 |
| private | ''getUniqueIntegers()'' | Returns an array of unique integers between 0 and 100 | 616 |
======== __construct() ========
public function __construct()
//lines 21–33 (13)//
//Takes no parameters.//
======== checkAnswer() ========
public function checkAnswer($answer)
//lines 43–68 (26)//
Checks whether a user's response matches the stored answer
^ Parameter ^ Type ^ Default ^ Description ^
| ''$answer'' | ''(untyped)'' | //required// | The user's submitted response |
**Returns:** ''(none declared)'' — boolean TRUE if the answer is correct
**Throws:** ''Exception''
======== getNewQuestion() ========
public function getNewQuestion()
//lines 77–108 (32)//
Generate a random question string and store the answer in the session
Important: call this method AFTER checking the user's response since it will replace the session answer variable
//Takes no parameters.//
**Returns:** ''(none declared)''
======== getAdditionProblem() ========
private function getAdditionProblem()
//lines 124–148 (25)//
Returns a random addition problem after adding the answer to the session
Example: "What is the sum of five and six?"
//Takes no parameters.//
**Returns:** ''(none declared)'' — string A random addition problem
======== getSubtractionProblem() ========
private function getSubtractionProblem()
//lines 164–192 (29)//
Returns a random subtraction problem
Example: "What is eight minus four?"
//Takes no parameters.//
**Returns:** ''(none declared)'' — string A random subtraction problem
======== getMultiplicationProblem() ========
private function getMultiplicationProblem()
//lines 208–232 (25)//
Returns a random multiplication problem
Example: "What is two multiplied by seven?"
//Takes no parameters.//
**Returns:** ''(none declared)'' — string A random multiplication problem
======== getDivisionProblem() ========
private function getDivisionProblem()
//lines 248–266 (19)//
Returns a random division problem
Example: "What is twenty divided by two?"
//Takes no parameters.//
**Returns:** ''(none declared)'' — string A random division question
======== getLetterProblem() ========
private function getLetterProblem()
//lines 278–414 (137)//
Get a random letter position question
Example: "What is the fifth letter in Tokyo?"
//Takes no parameters.//
**Returns:** ''(none declared)''
======== getNumberProblem() ========
private function getNumberProblem()
//lines 426–468 (43)//
For a range of three unique numbers, ask which one is largest or smallest
Example: "Which is largest: twenty-one, sixteen, or eighty-four?"
//Takes no parameters.//
**Returns:** ''(none declared)''
======== getWordFromNumber() ========
private function getWordFromNumber($number)
//lines 484–588 (105)//
Returns the name of any integer less than or equal to 100
^ Parameter ^ Type ^ Default ^ Description ^
| ''$number'' | ''(untyped)'' | //required// | A number no greater than 100 |
**Returns:** ''(none declared)'' — string The name of the integer
======== storeAnswer() ========
private function storeAnswer($answer)
//lines 598–602 (5)//
Store an answer in the session
^ Parameter ^ Type ^ Default ^ Description ^
| ''$answer'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
======== getUniqueIntegers() ========
private function getUniqueIntegers($howMany)
//lines 616–644 (29)//
Returns an array of unique integers between 0 and 100
^ Parameter ^ Type ^ Default ^ Description ^
| ''$howMany'' | ''(untyped)'' | //required// | //none// |
**Returns:** ''(none declared)''
----
//This page is generated from source by 'tools/gendoc'. Edits will be overwritten.//