SabrePluginEvent.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. <?php
  2. /**
  3. * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
  4. * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
  5. * SPDX-License-Identifier: AGPL-3.0-only
  6. */
  7. namespace OCP;
  8. use OCP\AppFramework\Http;
  9. use OCP\EventDispatcher\Event;
  10. use Sabre\DAV\Server;
  11. /**
  12. * @since 8.2.0
  13. */
  14. class SabrePluginEvent extends Event {
  15. /** @var int */
  16. protected $statusCode;
  17. /** @var string */
  18. protected $message;
  19. /** @var Server */
  20. protected $server;
  21. /**
  22. * @since 8.2.0
  23. */
  24. public function __construct($server = null) {
  25. $this->message = '';
  26. $this->statusCode = Http::STATUS_OK;
  27. $this->server = $server;
  28. }
  29. /**
  30. * @param int $statusCode
  31. * @return self
  32. * @since 8.2.0
  33. */
  34. public function setStatusCode($statusCode) {
  35. $this->statusCode = (int)$statusCode;
  36. return $this;
  37. }
  38. /**
  39. * @param string $message
  40. * @return self
  41. * @since 8.2.0
  42. */
  43. public function setMessage($message) {
  44. $this->message = (string)$message;
  45. return $this;
  46. }
  47. /**
  48. * @return int
  49. * @since 8.2.0
  50. */
  51. public function getStatusCode() {
  52. return $this->statusCode;
  53. }
  54. /**
  55. * @return string
  56. * @since 8.2.0
  57. */
  58. public function getMessage() {
  59. return $this->message;
  60. }
  61. /**
  62. * @return null|Server
  63. * @since 9.0.0
  64. */
  65. public function getServer() {
  66. return $this->server;
  67. }
  68. }