ARateLimit.php 692 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2023 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\AppFramework\Http\Attribute;
  8. /**
  9. * Attribute for controller methods that want to limit the times a logged-in
  10. * user can call the endpoint in a given time period.
  11. *
  12. * @since 27.0.0
  13. */
  14. abstract class ARateLimit {
  15. /**
  16. * @since 27.0.0
  17. */
  18. public function __construct(
  19. protected int $limit,
  20. protected int $period,
  21. ) {
  22. }
  23. /**
  24. * @since 27.0.0
  25. */
  26. public function getLimit(): int {
  27. return $this->limit;
  28. }
  29. /**
  30. * @since 27.0.0
  31. */
  32. public function getPeriod(): int {
  33. return $this->period;
  34. }
  35. }