aboutsummaryrefslogtreecommitdiffstats
path: root/lib/public/AppFramework/Controller.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/public/AppFramework/Controller.php')
-rw-r--r--lib/public/AppFramework/Controller.php41
1 files changed, 11 insertions, 30 deletions
diff --git a/lib/public/AppFramework/Controller.php b/lib/public/AppFramework/Controller.php
index 12a6a75cf0f..cdeaac99366 100644
--- a/lib/public/AppFramework/Controller.php
+++ b/lib/public/AppFramework/Controller.php
@@ -1,30 +1,9 @@
<?php
+
/**
- * @copyright Copyright (c) 2016, ownCloud, Inc.
- *
- * @author Bernhard Posselt <dev@bernhard-posselt.com>
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author Donquixote <marjunebatac@gmail.com>
- * @author Morris Jobke <hey@morrisjobke.de>
- * @author Roeland Jago Douma <roeland@famdouma.nl>
- * @author Thomas Müller <thomas.mueller@tmit.eu>
- * @author Thomas Tanghus <thomas@tanghus.net>
- * @author Vincent Petry <vincent@nextcloud.com>
- *
- * @license AGPL-3.0
- *
- * This code is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License, version 3,
- * as published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License, version 3,
- * along with this program. If not, see <http://www.gnu.org/licenses/>
- *
+ * SPDX-FileCopyrightText: 2016-2024 Nextcloud GmbH and Nextcloud contributors
+ * SPDX-FileCopyrightText: 2016 ownCloud, Inc.
+ * SPDX-License-Identifier: AGPL-3.0-only
*/
namespace OCP\AppFramework;
@@ -38,7 +17,6 @@ use OCP\IRequest;
* @since 6.0.0
*/
abstract class Controller {
-
/**
* app name
* @var string
@@ -66,7 +44,7 @@ abstract class Controller {
* @since 6.0.0 - parameter $appName was added in 7.0.0 - parameter $app was removed in 7.0.0
*/
public function __construct($appName,
- IRequest $request) {
+ IRequest $request) {
$this->appName = $appName;
$this->request = $request;
@@ -92,6 +70,9 @@ abstract class Controller {
if ($data->getLastModified() !== null) {
$response->setLastModified($data->getLastModified());
}
+ if ($data->isThrottled()) {
+ $response->throttle($data->getThrottleMetadata());
+ }
return $response;
}
@@ -142,7 +123,7 @@ abstract class Controller {
/**
* Serializes and formats a response
* @param mixed $response the value that was returned from a controller and
- * is not a Response instance
+ * is not a Response instance
* @param string $format the format for which a formatter has been registered
* @throws \DomainException if format does not match a registered formatter
* @return Response
@@ -154,7 +135,7 @@ abstract class Controller {
return $responder($response);
}
- throw new \DomainException('No responder registered for format '.
- $format . '!');
+ throw new \DomainException('No responder registered for format '
+ . $format . '!');
}
}