SabrePluginEvent.php 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596
  1. <?php
  2. /**
  3. * @copyright Copyright (c) 2016, ownCloud, Inc.
  4. *
  5. * @author Arthur Schiwon <blizzz@arthur-schiwon.de>
  6. * @author Joas Schilling <coding@schilljs.com>
  7. * @author Roeland Jago Douma <roeland@famdouma.nl>
  8. * @author Thomas Müller <thomas.mueller@tmit.eu>
  9. *
  10. * @license AGPL-3.0
  11. *
  12. * This code is free software: you can redistribute it and/or modify
  13. * it under the terms of the GNU Affero General Public License, version 3,
  14. * as published by the Free Software Foundation.
  15. *
  16. * This program is distributed in the hope that it will be useful,
  17. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  18. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  19. * GNU Affero General Public License for more details.
  20. *
  21. * You should have received a copy of the GNU Affero General Public License, version 3,
  22. * along with this program. If not, see <http://www.gnu.org/licenses/>
  23. *
  24. */
  25. namespace OCP;
  26. use OCP\AppFramework\Http;
  27. use OCP\EventDispatcher\Event;
  28. use Sabre\DAV\Server;
  29. /**
  30. * @since 8.2.0
  31. */
  32. class SabrePluginEvent extends Event {
  33. /** @var int */
  34. protected $statusCode;
  35. /** @var string */
  36. protected $message;
  37. /** @var Server */
  38. protected $server;
  39. /**
  40. * @since 8.2.0
  41. */
  42. public function __construct($server = null) {
  43. $this->message = '';
  44. $this->statusCode = Http::STATUS_OK;
  45. $this->server = $server;
  46. }
  47. /**
  48. * @param int $statusCode
  49. * @return self
  50. * @since 8.2.0
  51. */
  52. public function setStatusCode($statusCode) {
  53. $this->statusCode = (int) $statusCode;
  54. return $this;
  55. }
  56. /**
  57. * @param string $message
  58. * @return self
  59. * @since 8.2.0
  60. */
  61. public function setMessage($message) {
  62. $this->message = (string) $message;
  63. return $this;
  64. }
  65. /**
  66. * @return int
  67. * @since 8.2.0
  68. */
  69. public function getStatusCode() {
  70. return $this->statusCode;
  71. }
  72. /**
  73. * @return string
  74. * @since 8.2.0
  75. */
  76. public function getMessage() {
  77. return $this->message;
  78. }
  79. /**
  80. * @return null|Server
  81. * @since 9.0.0
  82. */
  83. public function getServer() {
  84. return $this->server;
  85. }
  86. }