/zf/library/Zend/Gdata/App/CaptchaRequiredException.php

http://github.com/eryx/php-framework-benchmark · PHP · 94 lines · 19 code · 9 blank · 66 comment · 0 complexity · df633e8491378a4b4784f3fb40241e27 MD5 · raw file

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