File indexing completed on 2025-03-02 05:29:26

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage App
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_App_CaptchaRequiredException
0026  */
0027 // require_once 'Zend/Gdata/App/AuthException.php';
0028 
0029 /**
0030  * Gdata exceptions
0031  *
0032  * Class to represent an exception that occurs during the use of ClientLogin.
0033  * This particular exception happens when a CAPTCHA challenge is issued. This
0034  * challenge is a visual puzzle presented to the user to prove that they are
0035  * not an automated system.
0036  *
0037  * @category   Zend
0038  * @package    Zend_Gdata
0039  * @subpackage App
0040  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0041  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0042  */
0043 class Zend_Gdata_App_CaptchaRequiredException extends Zend_Gdata_App_AuthException
0044 {
0045     /**
0046      * The Google Accounts URL prefix.
0047      */
0048     const ACCOUNTS_URL = 'https://www.google.com/accounts/';
0049 
0050     /**
0051      * The token identifier from the server.
0052      *
0053      * @var string
0054      */
0055     private $captchaToken;
0056 
0057     /**
0058      * The URL of the CAPTCHA image.
0059      *
0060      * @var string
0061      */
0062     private $captchaUrl;
0063 
0064     /**
0065      * Constructs the exception to handle a CAPTCHA required response.
0066      *
0067      * @param string $captchaToken The CAPTCHA token ID provided by the server.
0068      * @param string $captchaUrl The URL to the CAPTCHA challenge image.
0069      */
0070     public function __construct($captchaToken, $captchaUrl) {
0071         $this->captchaToken = $captchaToken;
0072         $this->captchaUrl = Zend_Gdata_App_CaptchaRequiredException::ACCOUNTS_URL . $captchaUrl;
0073         parent::__construct('CAPTCHA challenge issued by server');
0074     }
0075 
0076     /**
0077      * Retrieves the token identifier as provided by the server.
0078      *
0079      * @return string
0080      */
0081     public function getCaptchaToken() {
0082         return $this->captchaToken;
0083     }
0084 
0085     /**
0086      * Retrieves the URL CAPTCHA image as provided by the server.
0087      *
0088      * @return string
0089      */
0090     public function getCaptchaUrl() {
0091         return $this->captchaUrl;
0092     }
0093 
0094 }