2015-09-22 05:43:40 -04:00
|
|
|
<?php
|
2024-05-23 03:26:56 -04:00
|
|
|
|
2015-09-22 05:43:40 -04:00
|
|
|
/**
|
2024-05-23 03:26:56 -04:00
|
|
|
* SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
|
|
|
|
|
* SPDX-FileCopyrightText: 2016 ownCloud, Inc.
|
|
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
2015-09-22 05:43:40 -04:00
|
|
|
*/
|
|
|
|
|
namespace OCP;
|
|
|
|
|
|
|
|
|
|
use OCP\AppFramework\Http;
|
2019-10-16 06:36:03 -04:00
|
|
|
use OCP\EventDispatcher\Event;
|
2019-11-22 14:52:10 -05:00
|
|
|
use Sabre\DAV\Server;
|
2015-09-22 05:43:40 -04:00
|
|
|
|
2015-09-23 10:15:56 -04:00
|
|
|
/**
|
|
|
|
|
* @since 8.2.0
|
|
|
|
|
*/
|
2015-09-22 05:43:40 -04:00
|
|
|
class SabrePluginEvent extends Event {
|
|
|
|
|
/** @var int */
|
|
|
|
|
protected $statusCode;
|
|
|
|
|
|
|
|
|
|
/** @var string */
|
|
|
|
|
protected $message;
|
|
|
|
|
|
2015-12-04 06:11:07 -05:00
|
|
|
/** @var Server */
|
|
|
|
|
protected $server;
|
|
|
|
|
|
2015-09-23 10:15:56 -04:00
|
|
|
/**
|
|
|
|
|
* @since 8.2.0
|
|
|
|
|
*/
|
2015-12-04 06:11:07 -05:00
|
|
|
public function __construct($server = null) {
|
2015-09-22 05:43:40 -04:00
|
|
|
$this->message = '';
|
|
|
|
|
$this->statusCode = Http::STATUS_OK;
|
2015-12-04 06:11:07 -05:00
|
|
|
$this->server = $server;
|
2015-09-22 05:43:40 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param int $statusCode
|
|
|
|
|
* @return self
|
2015-09-23 10:15:56 -04:00
|
|
|
* @since 8.2.0
|
2015-09-22 05:43:40 -04:00
|
|
|
*/
|
|
|
|
|
public function setStatusCode($statusCode) {
|
|
|
|
|
$this->statusCode = (int)$statusCode;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @param string $message
|
|
|
|
|
* @return self
|
2015-09-23 10:15:56 -04:00
|
|
|
* @since 8.2.0
|
2015-09-22 05:43:40 -04:00
|
|
|
*/
|
|
|
|
|
public function setMessage($message) {
|
|
|
|
|
$this->message = (string)$message;
|
|
|
|
|
return $this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return int
|
2015-09-23 10:15:56 -04:00
|
|
|
* @since 8.2.0
|
2015-09-22 05:43:40 -04:00
|
|
|
*/
|
|
|
|
|
public function getStatusCode() {
|
|
|
|
|
return $this->statusCode;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return string
|
2015-09-23 10:15:56 -04:00
|
|
|
* @since 8.2.0
|
2015-09-22 05:43:40 -04:00
|
|
|
*/
|
|
|
|
|
public function getMessage() {
|
|
|
|
|
return $this->message;
|
|
|
|
|
}
|
2015-12-04 06:11:07 -05:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @return null|Server
|
|
|
|
|
* @since 9.0.0
|
|
|
|
|
*/
|
|
|
|
|
public function getServer() {
|
|
|
|
|
return $this->server;
|
|
|
|
|
}
|
2015-09-22 05:43:40 -04:00
|
|
|
}
|