public function generate()
    {
        try {

            if (!$this->isEnabled()) {
                throw new CaptchaDriverException(
                    'Captcha driver has not been configured.'
                );
            }

            $oResponse = $this->oDriver->generate();

            if (!($oResponse instanceof CaptchaForm)) {
                throw new CaptchaDriverException(
                    'Driver must return an instance of \Nails\Captcha\Factory\CaptchaForm.'
                );
            }

        } catch (\Exception $e) {
            $oResponse = Factory::factory('CaptchaForm', 'nails/module-captcha');
            $oResponse->setHtml(
                '<p style="color: red; padding: 1rem; border: 1px solid red;">ERROR: ' . $e->getMessage() . '</p>'
            );
        }

        return $oResponse;
    }
public function generate()
    {
        try {

            if (!$this->isEnabled()) {
                throw new CaptchaDriverException(
                    'Captcha driver has not been configured.'
                );
            }

            $oResponse = $this->oDriver->generate();

            if (!($oResponse instanceof CaptchaForm)) {
                throw new CaptchaDriverException(
                    'Driver must return an instance of \Nails\Captcha\Factory\CaptchaForm.'
                );
            }

        } catch (\Exception $e) {
            $oResponse = Factory::factory('CaptchaForm', 'nails/module-captcha');
            $oResponse->setHtml(
                '<p style="color: red; padding: 1rem; border: 1px solid red;">ERROR: ' . $e->getMessage() . '</p>'
            );
        }

        return $oResponse;
    }
public function generate ( ) { try { if ( ! $ this -> isEnabled ( ) ) { throw new CaptchaDriverException ( 'Captcha driver has not been configured.' ) ; } $ oResponse = $ this -> oDriver -> generate ( ) ; if ( ! ( $ oResponse instanceof CaptchaForm ) ) { throw new CaptchaDriverException ( 'Driver must return an instance of \Nails\Captcha\Factory\CaptchaForm.' ) ; } } catch ( \ Exception $ e ) { $ oResponse = Factory :: factory ( 'CaptchaForm' , 'nails/module-captcha' ) ; $ oResponse -> setHtml ( '<p style="color: red; padding: 1rem; border: 1px solid red;">ERROR: ' . $ e -> getMessage ( ) . '</p>' ) ; } return $ oResponse ; }
Returns the form markup for the captcha
@return CaptchaForm
Returns the form markup for the captcha