Provider.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. declare(strict_types=1);
  3. /*
  4. * This file is part of the Geocoder package.
  5. * For the full copyright and license information, please view the LICENSE
  6. * file that was distributed with this source code.
  7. *
  8. * @license MIT License
  9. */
  10. namespace Geocoder\Provider;
  11. use Geocoder\Collection;
  12. use Geocoder\Query\GeocodeQuery;
  13. use Geocoder\Query\ReverseQuery;
  14. /**
  15. * Providers MUST always be stateless and immutable.
  16. *
  17. * @author William Durand <william.durand1@gmail.com>
  18. * @author Tobias Nyholm <tobias.nyholm@gmail.com>
  19. */
  20. interface Provider
  21. {
  22. /**
  23. * @param GeocodeQuery $query
  24. *
  25. * @return Collection
  26. *
  27. * @throws \Geocoder\Exception\Exception
  28. */
  29. public function geocodeQuery(GeocodeQuery $query): Collection;
  30. /**
  31. * @param ReverseQuery $query
  32. *
  33. * @return Collection
  34. *
  35. * @throws \Geocoder\Exception\Exception
  36. */
  37. public function reverseQuery(ReverseQuery $query): Collection;
  38. /**
  39. * Returns the provider's name.
  40. *
  41. * @return string
  42. */
  43. public function getName(): string;
  44. }