Location.php 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116
  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;
  11. use Geocoder\Model\AdminLevelCollection;
  12. use Geocoder\Model\Bounds;
  13. use Geocoder\Model\Coordinates;
  14. use Geocoder\Model\Country;
  15. /**
  16. * A location is a single result from a Geocoder.
  17. *
  18. * @author William Durand <william.durand1@gmail.com>
  19. * @author Tobias Nyholm <tobias.nyholm@gmail.com>
  20. */
  21. interface Location
  22. {
  23. /**
  24. * Will always return the coordinates value object.
  25. *
  26. * @return Coordinates|null
  27. */
  28. public function getCoordinates();
  29. /**
  30. * Returns the bounds value object.
  31. *
  32. * @return Bounds|null
  33. */
  34. public function getBounds();
  35. /**
  36. * Returns the street number value.
  37. *
  38. * @return string|int|null
  39. */
  40. public function getStreetNumber();
  41. /**
  42. * Returns the street name value.
  43. *
  44. * @return string|null
  45. */
  46. public function getStreetName();
  47. /**
  48. * Returns the city or locality value.
  49. *
  50. * @return string|null
  51. */
  52. public function getLocality();
  53. /**
  54. * Returns the postal code or zipcode value.
  55. *
  56. * @return string|null
  57. */
  58. public function getPostalCode();
  59. /**
  60. * Returns the locality district, or
  61. * sublocality, or neighborhood.
  62. *
  63. * @return string|null
  64. */
  65. public function getSubLocality();
  66. /**
  67. * Returns the administrative levels.
  68. *
  69. * This method MUST NOT return null.
  70. *
  71. * @return AdminLevelCollection
  72. */
  73. public function getAdminLevels(): AdminLevelCollection;
  74. /**
  75. * Returns the country value object.
  76. *
  77. * @return Country|null
  78. */
  79. public function getCountry();
  80. /**
  81. * Returns the timezone for the Location. The timezone MUST be in the list of supported timezones.
  82. *
  83. * {@link http://php.net/manual/en/timezones.php}
  84. *
  85. * @return string|null
  86. */
  87. public function getTimezone();
  88. /**
  89. * Returns an array with data indexed by name.
  90. *
  91. * @return array
  92. */
  93. public function toArray(): array;
  94. /**
  95. * The name of the provider that created this Location.
  96. *
  97. * @return string
  98. */
  99. public function getProvidedBy(): string;
  100. }