SabrePluginEvent.php 1.9 KB

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