NotFoundResponse.php 821 B

123456789101112131415161718192021222324252627282930
  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\AppFramework\Http;
  8. use OCP\AppFramework\Http;
  9. /**
  10. * A generic 404 response showing an 404 error page as well to the end-user
  11. * @since 8.1.0
  12. * @template S of int
  13. * @template H of array<string, mixed>
  14. * @template-extends TemplateResponse<int, array<string, mixed>>
  15. */
  16. class NotFoundResponse extends TemplateResponse {
  17. /**
  18. * @param S $status
  19. * @param H $headers
  20. * @since 8.1.0
  21. */
  22. public function __construct(int $status = Http::STATUS_NOT_FOUND, array $headers = []) {
  23. parent::__construct('core', '404', [], 'guest', $status, $headers);
  24. $this->setContentSecurityPolicy(new ContentSecurityPolicy());
  25. }
  26. }