private function Reader::getRecord in Smart IP 7.2
Same name and namespace in other branches
- 6.2 includes/vendor/geoip2/geoip2/src/Database/Reader.php \GeoIp2\Database\Reader::getRecord()
2 calls to Reader::getRecord()
- Reader::flatModelFor in includes/
vendor/ geoip2/ geoip2/ src/ Database/ Reader.php - Reader::modelFor in includes/
vendor/ geoip2/ geoip2/ src/ Database/ Reader.php
File
- includes/
vendor/ geoip2/ geoip2/ src/ Database/ Reader.php, line 211
Class
- Reader
- Instances of this class provide a reader for the GeoIP2 database format. IP addresses can be looked up using the database specific methods.
Namespace
GeoIp2\DatabaseCode
private function getRecord($class, $type, $ipAddress) {
if (strpos($this
->metadata()->databaseType, $type) === false) {
$method = lcfirst($class);
throw new \BadMethodCallException("The {$method} method cannot be used to open a " . $this
->metadata()->databaseType . " database");
}
$record = $this->dbReader
->get($ipAddress);
if ($record === null) {
throw new AddressNotFoundException("The address {$ipAddress} is not in the database.");
}
return $record;
}