Tiger_Location_Adapter_Abstract

@api · implements Tiger_Location_Adapter_Interface

Tiger_Location_Adapter_Abstract — base for Location adapters.

Every operation defaults to "unsupported" (throws), so a concrete adapter overrides ONLY the ones it provides and lists them in capabilities(). Also carries the adapter's config (from tiger.location.adapters.) and a small JSON-over-HTTP helper the concrete adapters share.

Methods

__construct()

__construct(array $config = [])

Store the adapter's config (from tiger.location.adapters.).

  • $config array — the adapter's config map

capabilities()

capabilities(): array

The CAP_* operations this adapter supports (none by default).

Returns array — a list of CAP_* capability constants

supports()

supports(string $capability): bool

Does this adapter support a CAP_* operation?

  • $capability string — the CAP_* capability to check

Returns bool — true if the operation is supported

suggest()

suggest(string $query, array $opts = []): array

Suggest address matches (unsupported here — override in a capable adapter).

  • $query string — the partial address text
  • $opts array — provider options

Returns array — the suggestions

Throws Tiger_Location_Exception — always, unless the adapter overrides this

geocode()

geocode(string $query, array $opts = []): array

Geocode free text (unsupported here — override in a capable adapter).

  • $query string — the address text to geocode
  • $opts array — provider options

Returns array — the matches

Throws Tiger_Location_Exception — always, unless the adapter overrides this

reverse()

reverse(float $lat, float $lng, array $opts = []): ?Tiger_Location_Place

Reverse-geocode a coordinate (unsupported here — override in a capable adapter).

  • $lat float — the latitude
  • $lng float — the longitude
  • $opts array — provider options

Returns ?Tiger_Location_Place — the nearest place

Throws Tiger_Location_Exception — always, unless the adapter overrides this

ip()

ip(string $ip, array $opts = []): ?Tiger_Location_Place

Geolocate an IP (unsupported here — override in a capable adapter).

  • $ip string — the IP address to look up
  • $opts array — provider options

Returns ?Tiger_Location_Place — the place

Throws Tiger_Location_Exception — always, unless the adapter overrides this