You are here

final class Loqate in Loqate 8

Same name and namespace in other branches
  1. 2.x src/Loqate.php \Drupal\loqate\Loqate

Class Loqate.

@package Drupal\loqate

Hierarchy

Expanded class hierarchy of Loqate

1 file declares its use of Loqate
WebformAddressLoqate.php in modules/pca_webform/src/Element/WebformAddressLoqate.php
1 string reference to 'Loqate'
loqate.info.yml in ./loqate.info.yml
loqate.info.yml

File

src/Loqate.php, line 12

Namespace

Drupal\loqate
View source
final class Loqate {

  /**
   * Gets the Loqate API key value.
   *
   * @param null $key_id
   *   Optional custom key module key id.
   *
   * @return string|null
   *   The key value if found or NULL.
   */
  public static function getApiKey($key_id = NULL) {
    if ($key_id === NULL) {
      $key_id = \Drupal::config('loqate.loqateapikeyconfig')
        ->get(LoqateApiKeyConfigForm::DEFAULT_API_KEY);
    }
    if ($key_id) {

      /** @var \Drupal\key\KeyRepositoryInterface $key_repository */
      $key_repository = \Drupal::service('key.repository');
      $key_entity = $key_repository
        ->getKey($key_id);
      if ($key_entity) {
        return $key_entity
          ->getKeyValue();
      }
    }
    return NULL;
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Loqate::getApiKey public static function Gets the Loqate API key value.