mirror of
https://github.com/librenms/librenms.git
synced 2024-10-07 16:52:45 +00:00
Type API methods and properties (#14476)
* Type properties * Comment method * Update base_uri child property * Update BingApi.php * Update GoogleMapsApi.php * Update MapquestApi.php * Update NominatimApi.php * Update RipeApi.php * Update phpstan-baseline.neon * Update phpstan-baseline.neon * Fix indent * Fix escaping * Update phpstan-baseline.neon * Update phpstan-baseline.neon * Update phpstan-baseline.neon * Update phpstan-baseline.neon * Update phpstan-baseline.neon * Update phpstan-baseline.neon * Update phpstan-baseline.neon * Update phpstan-baseline.neon * StyleCI indent * Update phpstan-baseline.neon * Make possible for $client to be null * Remove comments * Remove comments * Remove comments * Update MapquestApi.php * Update NominatimApi.php * Remove comments * Remove comments * $base_uri not nullable * $base_uri not nullable * $base_uri not nullable * $base_uri not nullable * $base_uri not nullable * $base_uri not nullable * Type method and properties * Type method and properties * Type method and properties * Type method and properties * Type method and properties * Type method and properties * Type $client * Type method and properties * Remove errors not matched anymore * Fix type errors in graylogapi * Mixed can't be ORed * uri never null * Update app/ApiClients/GraylogApi.php * Fix getAdresses Type * Collection changed its folder? * Fix directory, there was just a backslash missing Co-authored-by: Tony Murray <murraytony@gmail.com>
This commit is contained in:
@@ -34,16 +34,13 @@ class GoogleMapsApi extends BaseApi implements Geocoder
|
||||
{
|
||||
use GeocodingHelper;
|
||||
|
||||
protected $base_uri = 'https://maps.googleapis.com';
|
||||
protected $geocoding_uri = '/maps/api/geocode/json';
|
||||
protected string $base_uri = 'https://maps.googleapis.com';
|
||||
protected string $geocoding_uri = '/maps/api/geocode/json';
|
||||
|
||||
/**
|
||||
* Get latitude and longitude from geocode response
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function parseLatLng($data)
|
||||
protected function parseLatLng(array $data): array
|
||||
{
|
||||
return [
|
||||
'lat' => isset($data['results'][0]['geometry']['location']['lat']) ? $data['results'][0]['geometry']['location']['lat'] : 0,
|
||||
@@ -53,11 +50,8 @@ class GoogleMapsApi extends BaseApi implements Geocoder
|
||||
|
||||
/**
|
||||
* Get messages from response.
|
||||
*
|
||||
* @param array $data
|
||||
* @return array
|
||||
*/
|
||||
protected function parseMessages($data)
|
||||
protected function parseMessages(array $data): array
|
||||
{
|
||||
return [
|
||||
'error' => isset($data['error_message']) ? $data['error_message'] : '',
|
||||
@@ -68,12 +62,9 @@ class GoogleMapsApi extends BaseApi implements Geocoder
|
||||
/**
|
||||
* Build Guzzle request option array
|
||||
*
|
||||
* @param string $address
|
||||
* @return array
|
||||
*
|
||||
* @throws \Exception you may throw an Exception if validation fails
|
||||
*/
|
||||
protected function buildGeocodingOptions($address)
|
||||
protected function buildGeocodingOptions(string $address): array
|
||||
{
|
||||
$api_key = Config::get('geoloc.api_key');
|
||||
if (! $api_key) {
|
||||
|
Reference in New Issue
Block a user