]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - Zend/Gdata/App/CaptchaRequiredException.php
Release 6.5.0
[Github/sugarcrm.git] / Zend / Gdata / App / CaptchaRequiredException.php
1 <?php
2
3 /**
4  * Zend Framework
5  *
6  * LICENSE
7  *
8  * This source file is subject to the new BSD license that is bundled
9  * with this package in the file LICENSE.txt.
10  * It is also available through the world-wide-web at this URL:
11  * http://framework.zend.com/license/new-bsd
12  * If you did not receive a copy of the license and are unable to
13  * obtain it through the world-wide-web, please send an email
14  * to license@zend.com so we can send you a copy immediately.
15  *
16  * @category   Zend
17  * @package    Zend_Gdata
18  * @subpackage App
19  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
21
22  */
23
24 /**
25  * @see Zend_Gdata_App_CaptchaRequiredException
26  */
27 require_once 'Zend/Gdata/App/AuthException.php';
28
29 /**
30  * Gdata exceptions
31  *
32  * Class to represent an exception that occurs during the use of ClientLogin.
33  * This particular exception happens when a CAPTCHA challenge is issued. This
34  * challenge is a visual puzzle presented to the user to prove that they are
35  * not an automated system.
36  *
37  * @category   Zend
38  * @package    Zend_Gdata
39  * @subpackage App
40  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41  * @license    http://framework.zend.com/license/new-bsd     New BSD License
42  */
43 class Zend_Gdata_App_CaptchaRequiredException extends Zend_Gdata_App_AuthException
44 {
45     /**
46      * The Google Accounts URL prefix.
47      */
48     const ACCOUNTS_URL = 'https://www.google.com/accounts/';
49
50     /**
51      * The token identifier from the server.
52      *
53      * @var string
54      */
55     private $captchaToken;
56
57     /**
58      * The URL of the CAPTCHA image.
59      *
60      * @var string
61      */
62     private $captchaUrl;
63
64     /**
65      * Constructs the exception to handle a CAPTCHA required response.
66      *
67      * @param string $captchaToken The CAPTCHA token ID provided by the server.
68      * @param string $captchaUrl The URL to the CAPTCHA challenge image.
69      */
70     public function __construct($captchaToken, $captchaUrl) {
71         $this->captchaToken = $captchaToken;
72         $this->captchaUrl = Zend_Gdata_App_CaptchaRequiredException::ACCOUNTS_URL . $captchaUrl;
73         parent::__construct('CAPTCHA challenge issued by server');
74     }
75
76     /**
77      * Retrieves the token identifier as provided by the server.
78      *
79      * @return string
80      */
81     public function getCaptchaToken() {
82         return $this->captchaToken;
83     }
84
85     /**
86      * Retrieves the URL CAPTCHA image as provided by the server.
87      *
88      * @return string
89      */
90     public function getCaptchaUrl() {
91         return $this->captchaUrl;
92     }
93
94 }