You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

enigma_error.php 1.6KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /**
  3. +-------------------------------------------------------------------------+
  4. | Error class for the Enigma Plugin |
  5. | |
  6. | Copyright (C) 2010-2015 The Roundcube Dev Team |
  7. | |
  8. | Licensed under the GNU General Public License version 3 or |
  9. | any later version with exceptions for skins & plugins. |
  10. | See the README file for a full license statement. |
  11. | |
  12. +-------------------------------------------------------------------------+
  13. | Author: Aleksander Machniak <alec@alec.pl> |
  14. +-------------------------------------------------------------------------+
  15. */
  16. class enigma_error
  17. {
  18. private $code;
  19. private $message;
  20. private $data = array();
  21. // error codes
  22. const OK = 0;
  23. const INTERNAL = 1;
  24. const NODATA = 2;
  25. const KEYNOTFOUND = 3;
  26. const DELKEY = 4;
  27. const BADPASS = 5;
  28. const EXPIRED = 6;
  29. const UNVERIFIED = 7;
  30. function __construct($code = null, $message = '', $data = array())
  31. {
  32. $this->code = $code;
  33. $this->message = $message;
  34. $this->data = $data;
  35. }
  36. function getCode()
  37. {
  38. return $this->code;
  39. }
  40. function getMessage()
  41. {
  42. return $this->message;
  43. }
  44. function getData($name)
  45. {
  46. return $name ? $this->data[$name] : $this->data;
  47. }
  48. }