1
0

ParameterOutOfRangeException.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  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;
  8. /**
  9. * @since 29.0.0
  10. */
  11. class ParameterOutOfRangeException extends \OutOfRangeException {
  12. /**
  13. * @since 29.0.0
  14. */
  15. public function __construct(
  16. protected string $parameterName,
  17. protected int $actualValue,
  18. protected int $minValue,
  19. protected int $maxValue,
  20. ) {
  21. parent::__construct(
  22. sprintf(
  23. 'Parameter %s must be between %d and %d',
  24. $this->parameterName,
  25. $this->minValue,
  26. $this->maxValue,
  27. )
  28. );
  29. }
  30. /**
  31. * @since 29.0.0
  32. */
  33. public function getParameterName(): string {
  34. return $this->parameterName;
  35. }
  36. /**
  37. * @since 29.0.0
  38. */
  39. public function getActualValue(): int {
  40. return $this->actualValue;
  41. }
  42. /**
  43. * @since 29.0.0
  44. */
  45. public function getMinValue(): int {
  46. return $this->minValue;
  47. }
  48. /**
  49. * @since 29.0.0
  50. */
  51. public function getMaxValue(): int {
  52. return $this->maxValue;
  53. }
  54. }