Exception.php 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. <?php
  2. /**
  3. * @file
  4. * TeamSpeak 3 PHP Framework
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * @package TeamSpeak3
  20. * @author Sven 'ScP' Paulsen
  21. * @copyright Copyright (c) Planet TeamSpeak. All rights reserved.
  22. */
  23. /**
  24. * @class TeamSpeak3_Adapter_ServerQuery_Exception
  25. * @brief Enhanced exception class for TeamSpeak3_Adapter_ServerQuery objects.
  26. */
  27. class TeamSpeak3_Adapter_ServerQuery_Exception extends TeamSpeak3_Adapter_Exception
  28. {
  29. /**
  30. * Stores the optional return code for ServerQuery errors.
  31. *
  32. * @var string
  33. */
  34. protected $return_code = null;
  35. /**
  36. * The TeamSpeak3_Adapter_ServerQuery_Exception constructor.
  37. *
  38. * @param string $mesg
  39. * @param integer $code
  40. * @param string $return_code
  41. * @return TeamSpeak3_Adapter_ServerQuery_Exception
  42. */
  43. public function __construct($mesg, $code = 0x00, $return_code = null)
  44. {
  45. parent::__construct($mesg, $code);
  46. $this->return_code = $return_code;
  47. }
  48. /**
  49. * Returns TRUE if the exception provides a return code for ServerQuery errors.
  50. *
  51. * @return boolean
  52. */
  53. public function hasReturnCode()
  54. {
  55. return $this->return_code !== null;
  56. }
  57. /**
  58. * Returns the optional return code for ServerQuery errors.
  59. *
  60. * @return string
  61. */
  62. public function getReturnCode()
  63. {
  64. return $this->return_code;
  65. }
  66. }