You are here

public function Database::getFields in Smart IP 7.2

Same name and namespace in other branches
  1. 6.2 includes/vendor/ip2location/ip2location-php/IP2Location.php \IP2Location\Database::getFields()

Return this database's available fields

@access public

Parameters

boolean $asNames Whether to return the mapped names intead of numbered constants:

Return value

array

File

includes/vendor/ip2location/ip2location-php/IP2Location.php, line 1566

Class

Database
IP2Location database class

Namespace

IP2Location

Code

public function getFields($asNames = false) {
  $result = array_keys(array_filter(self::$columns, function ($field) {
    return 0 !== $field[$this->type];
  }));
  if ($asNames) {
    $return = [];
    foreach ($result as $field) {
      $return[] = self::$names[$field];
    }
    return $return;
  }
  else {
    return $result;
  }
}