You are here

public function AbstractRecord::__get in Smart IP 6.2

Same name and namespace in other branches
  1. 7.2 includes/vendor/geoip2/geoip2/src/Record/AbstractRecord.php \GeoIp2\Record\AbstractRecord::__get()

@ignore

1 call to AbstractRecord::__get()
AbstractPlaceRecord::__get in includes/vendor/geoip2/geoip2/src/Record/AbstractPlaceRecord.php
@ignore
1 method overrides AbstractRecord::__get()
AbstractPlaceRecord::__get in includes/vendor/geoip2/geoip2/src/Record/AbstractPlaceRecord.php
@ignore

File

includes/vendor/geoip2/geoip2/src/Record/AbstractRecord.php, line 22

Class

AbstractRecord

Namespace

GeoIp2\Record

Code

public function __get($attr) {

  // XXX - kind of ugly but greatly reduces boilerplate code
  $key = $this
    ->attributeToKey($attr);
  if ($this
    ->__isset($attr)) {
    return $this->record[$key];
  }
  elseif ($this
    ->validAttribute($attr)) {
    if (preg_match('/^is_/', $key)) {
      return false;
    }
    else {
      return null;
    }
  }
  else {
    throw new \RuntimeException("Unknown attribute: {$attr}");
  }
}