IAddress.php 602 B

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Security\Ip;
  8. /**
  9. * @since 30.0.0
  10. */
  11. interface IAddress {
  12. /**
  13. * Check if a given IP address is valid
  14. *
  15. * @since 30.0.0
  16. */
  17. public static function isValid(string $ip): bool;
  18. /**
  19. * Check if current address is contained by given ranges
  20. *
  21. * @since 30.0.0
  22. */
  23. public function matches(IRange ... $ranges): bool;
  24. /**
  25. * Normalized IP address
  26. *
  27. * @since 30.0.0
  28. */
  29. public function __toString(): string;
  30. }