Back to Captcha class

Method checkAnswer

public bool
checkAnswer
(mixed $code)
Checks if the answer is correct.
Parameters
  • string $code The answer.
Returns
  • bool Whether the provided answer was correct
Since
  • 2.5
-
  • \RuntimeException
Class: Captcha
Project: Joomla

Method checkAnswer - Source code

/**
 * Checks if the answer is correct.
 *
 * @param   string  $code  The answer.
 *
 * @return  bool    Whether the provided answer was correct
 *
 * @since	2.5
 * @throws  \RuntimeException
 */
public function checkAnswer($code)
{
    // Check if captcha is already loaded
    if ($this->captcha === null) {
        return false;
    }
    $arg = ['code' => $code];
    $result = $this->update('onCheckAnswer', $arg);
    return $result;
}