You are here

public function SmartIpLocation::get in Smart IP 8.3

Same name and namespace in other branches
  1. 8.4 src/SmartIpLocation.php \Drupal\smart_ip\SmartIpLocation::get()
  2. 8.2 src/SmartIpLocation.php \Drupal\smart_ip\SmartIpLocation::get()

Gets an item in Smart IP location data or all the Smart IP location data if supplied no parameter.

Parameters

string $key: Name of the item in Smart IP location data.

Return value

mixed Value of the requested item in Smart IP location data or an array of it.

Overrides SmartIpLocationInterface::get

File

src/SmartIpLocation.php, line 155
Contains \Drupal\smart_ip\SmartIpLocation.

Class

SmartIpLocation
Implements wrapper and utility methods for Smart IP's data location.

Namespace

Drupal\smart_ip

Code

public function get($key = NULL) {
  if (!empty($key)) {
    $value = $this->{$key};
    if (!empty($value)) {
      return $value;
    }
    $this
      ->getData(FALSE);
    if (isset($this->allData[$key])) {
      return $this->allData[$key];
    }
    else {
      return NULL;
    }
  }
  return $this
    ->getData(FALSE);
}