class Provider in Geocoder 7.2
Hierarchy
- class \Drupal\geocoder\Plugin\GeocoderPlugin extends \Drupal\Component\Plugin\PluginBase implements GeocoderPluginInterface
- class \Drupal\geocoder\Plugin\Geocoder\Provider implements ProviderInterface
Expanded class hierarchy of Provider
18 files declare their use of Provider
- ArcGISOnline.php in src/
Plugin/ Geocoder/ Provider/ ArcGISOnline.php - The ArcGISOnline plugin.
- BingMaps.php in src/
Plugin/ Geocoder/ Provider/ BingMaps.php - The BingMaps plugin.
- File.php in src/
Plugin/ Geocoder/ Provider/ File.php - The File plugin.
- FreeGeoIp.php in src/
Plugin/ Geocoder/ Provider/ FreeGeoIp.php - The FreeGeoIp plugin.
- Geoip.php in src/
Plugin/ Geocoder/ Provider/ Geoip.php - The Geoip plugin.
5 string references to 'Provider'
- Geocoder::geocode in src/
Geocoder.php - Geocode a string.
- Geocoder::reverse in src/
Geocoder.php - Reverse geocode coordinates.
- geocoder_field_field_formatter_settings_form in modules/
geocoder_field/ geocoder_field.module - Implements hook_field_formatter_settings_form().
- geocoder_field_field_widget_settings_form in modules/
geocoder_field/ geocoder_field.module - Implements hook_field_widget_settings_form().
- geocoder_services_permission in modules/
geocoder_services/ geocoder_services.module - Implements hook_permission().
File
- src/
Plugin/ Geocoder/ Provider.php, line 16 - Contains \Drupal\geocoder\Plugin\Geocoder\Provider.
Namespace
Drupal\geocoder\Plugin\GeocoderView source
class Provider extends GeocoderPlugin implements ProviderInterface {
/**
* The messenger service.
*
* @var MessengerInterface
*/
protected $messenger;
/**
* The loggerChannel service.
*
* @var LoggerChannelInterface
*/
protected $loggerChannel;
/**
* @var HttpAdapterInterface
*/
private $adapter;
/**
* @var \Geocoder\Provider\Provider
*/
private $handler;
/**
* {@inheritdoc}
*/
public function __construct($configuration, $plugin_id, $plugin_definition, HttpAdapterInterface $adapter, LoggerChannelInterface $logger_channel, MessengerInterface $messenger) {
$this->loggerChannel = $logger_channel;
$this->messenger = $messenger;
$this->adapter = $adapter;
parent::__construct($configuration, $plugin_id, $plugin_definition);
}
/**
* The Geocoder Provider.
*
* @param \Geocoder\Provider\Provider $handler
* The Geocoder provider.
*
* @return ProviderInterface
* The plugin provider.
*/
public function setHandler(\Geocoder\Provider\Provider $handler) {
$this->handler = $handler;
return $this;
}
/**
* Get the Geocoder handler.
*
* @return \Geocoder\Provider\Provider
*/
public function getHandler() {
return $this->handler;
}
/**
* Returns the HTTP adapter.
*
* @return HttpAdapterInterface
*/
public function getAdapter() {
return $this->adapter;
}
/**
* {@inheritdoc}
*/
public function geocode($data) {
$cid = $this
->getCacheCid($data);
if ($value = $this
->cache_get($cid)) {
return $value;
}
try {
$value = $this
->getHandler()
->geocode($data);
} catch (\Exception $e) {
throw $e;
} catch (\InvalidCredentials $e) {
throw $e;
}
$this
->cache_set($cid, $value);
return $value;
}
/**
* {@inheritdoc}
*/
public function reverse($latitude, $longitude) {
$cid = $this
->getCacheCid($latitude, $longitude);
if ($value = $this
->cache_get($cid)) {
return $value;
}
try {
$value = $this
->getHandler()
->reverse($latitude, $longitude);
} catch (\Exception $e) {
throw $e;
}
$this
->cache_set($cid, $value);
return $value;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
GeocoderPlugin:: |
public | function |
Get a cache object based on the cache ID. Overrides GeocoderPluginInterface:: |
|
GeocoderPlugin:: |
public | function |
Stores data in the persistent cache. Overrides GeocoderPluginInterface:: |
|
GeocoderPlugin:: |
public | function |
Generates a cache ID based on the arguments. Overrides GeocoderPluginInterface:: |
|
GeocoderPlugin:: |
public | function |
Get the object's configuration. Overrides GeocoderPluginInterface:: |
|
GeocoderPlugin:: |
public | function |
Init method launched after object initialization. Overrides GeocoderPluginInterface:: |
18 |
GeocoderPlugin:: |
public | function |
Set the object's configuration. Overrides GeocoderPluginInterface:: |
|
Provider:: |
private | property | ||
Provider:: |
private | property | ||
Provider:: |
protected | property | The loggerChannel service. | |
Provider:: |
protected | property | The messenger service. | |
Provider:: |
public | function |
Geocode data Overrides ProviderInterface:: |
1 |
Provider:: |
public | function |
Returns the HTTP adapter. Overrides ProviderInterface:: |
|
Provider:: |
public | function |
Get the Geocoder handler. Overrides ProviderInterface:: |
|
Provider:: |
public | function |
Reverse geocode latitude and longitude. Overrides ProviderInterface:: |
1 |
Provider:: |
public | function |
The Geocoder Provider. Overrides ProviderInterface:: |
|
Provider:: |
public | function |
GeocoderPlugin constructor. Overrides GeocoderPlugin:: |