BanIpManagerInterface.php 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. namespace Drupal\ban;
  3. /**
  4. * Provides an interface defining a BanIp manager.
  5. */
  6. interface BanIpManagerInterface {
  7. /**
  8. * Returns if this IP address is banned.
  9. *
  10. * @param string $ip
  11. * The IP address to check.
  12. *
  13. * @return bool
  14. * TRUE if the IP address is banned, FALSE otherwise.
  15. */
  16. public function isBanned($ip);
  17. /**
  18. * Finds all banned IP addresses.
  19. *
  20. * @return \Drupal\Core\Database\StatementInterface
  21. * The result of the database query.
  22. */
  23. public function findAll();
  24. /**
  25. * Bans an IP address.
  26. *
  27. * @param string $ip
  28. * The IP address to ban.
  29. */
  30. public function banIp($ip);
  31. /**
  32. * Unbans an IP address.
  33. *
  34. * @param string $id
  35. * The IP address to unban.
  36. */
  37. public function unbanIp($id);
  38. /**
  39. * Finds a banned IP address by its ID.
  40. *
  41. * @param int $ban_id
  42. * The ID for a banned IP address.
  43. *
  44. * @return string|false
  45. * Either the banned IP address or FALSE if none exist with that ID.
  46. */
  47. public function findById($ban_id);
  48. }