Rename GeoIP2 => GeoIp2 for consistency

This commit is contained in:
Gregory Oschwald
2013-07-10 15:24:40 -07:00
parent 1c37dcac03
commit e60181f13a
28 changed files with 179 additions and 177 deletions
+34
View File
@@ -0,0 +1,34 @@
<?php
namespace GeoIp2\Record;
abstract class AbstractRecord
{
private $record;
/**
* @ignore
*/
public function __construct($record)
{
$this->record = $record;
}
/**
* @ignore
*/
public function __get($attr)
{
$valid = in_array($attr, $this->validAttributes);
// XXX - kind of ugly but greatly reduces boilerplate code
$key = strtolower(preg_replace('/([A-Z])/', '_\1', $attr));
if ($valid && isset($this->record[$key])) {
return $this->record[$key];
} elseif ($valid) {
return null;
} else {
throw new \RuntimeException("Unknown attribute: $attr");
}
}
}