Exception.php 3.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?php
  2. /**
  3. * Soundcloud missing client id exception.
  4. *
  5. * @category Services
  6. * @package Services_Soundcloud
  7. * @author Anton Lindqvist <anton@qvister.se>
  8. * @copyright 2010 Anton Lindqvist <anton@qvister.se>
  9. * @license http://www.opensource.org/licenses/mit-license.php MIT
  10. * @link http://github.com/mptre/php-soundcloud
  11. */
  12. class Services_Soundcloud_Missing_Client_Id_Exception extends Exception {
  13. /**
  14. * Default message.
  15. *
  16. * @access protected
  17. *
  18. * @var string
  19. */
  20. protected $message = 'All requests must include a consumer key. Referred to as client_id in OAuth2.';
  21. }
  22. /**
  23. * Soundcloud invalid HTTP response code exception.
  24. *
  25. * @category Services
  26. * @package Services_Soundcloud
  27. * @author Anton Lindqvist <anton@qvister.se>
  28. * @copyright 2010 Anton Lindqvist <anton@qvister.se>
  29. * @license http://www.opensource.org/licenses/mit-license.php MIT
  30. * @link http://github.com/mptre/php-soundcloud
  31. */
  32. class Services_Soundcloud_Invalid_Http_Response_Code_Exception extends Exception {
  33. /**
  34. * HTTP response body.
  35. *
  36. * @access protected
  37. *
  38. * @var string
  39. */
  40. protected $httpBody;
  41. /**
  42. * HTTP response code.
  43. *
  44. * @access protected
  45. *
  46. * @var integer
  47. */
  48. protected $httpCode;
  49. /**
  50. * Default message.
  51. *
  52. * @access protected
  53. *
  54. * @var string
  55. */
  56. protected $message = 'The requested URL responded with HTTP code %d.';
  57. /**
  58. * Constructor.
  59. *
  60. * @param string $message
  61. * @param string $code
  62. * @param string $httpBody
  63. * @param integer $httpCode
  64. *
  65. * @return void
  66. */
  67. function __construct($message = null, $code = 0, $httpBody = null, $httpCode = 0) {
  68. $this->httpBody = $httpBody;
  69. $this->httpCode = $httpCode;
  70. $message = sprintf($this->message, $httpCode);
  71. parent::__construct($message, $code);
  72. }
  73. /**
  74. * Get HTTP response body.
  75. *
  76. * @return mixed
  77. */
  78. function getHttpBody() {
  79. return $this->httpBody;
  80. }
  81. /**
  82. * Get HTTP response code.
  83. *
  84. * @return mixed
  85. */
  86. function getHttpCode() {
  87. return $this->httpCode;
  88. }
  89. }
  90. /**
  91. * Soundcloud unsupported response format exception.
  92. *
  93. * @category Services
  94. * @package Services_Soundcloud
  95. * @author Anton Lindqvist <anton@qvister.se>
  96. * @copyright 2010 Anton Lindqvist <anton@qvister.se>
  97. * @license http://www.opensource.org/licenses/mit-license.php MIT
  98. * @link http://github.com/mptre/php-soundcloud
  99. */
  100. class Services_Soundcloud_Unsupported_Response_Format_Exception extends Exception {
  101. /**
  102. * Default message.
  103. *
  104. * @access protected
  105. *
  106. * @var string
  107. */
  108. protected $message = 'The given response format is unsupported.';
  109. }
  110. /**
  111. * Soundcloud unsupported audio format exception.
  112. *
  113. * @category Services
  114. * @package Services_Soundcloud
  115. * @author Anton Lindqvist <anton@qvister.se>
  116. * @copyright 2010 Anton Lindqvist <anton@qvister.se>
  117. * @license http://www.opensource.org/licenses/mit-license.php MIT
  118. * @link http://github.com/mptre/php-soundcloud
  119. */
  120. class Services_Soundcloud_Unsupported_Audio_Format_Exception extends Exception {
  121. /**
  122. * Default message.
  123. *
  124. * @access protected
  125. *
  126. * @var string
  127. */
  128. protected $message = 'The given audio format is unsupported.';
  129. }