Check attribute validity and return null on empty but valid attributes
This commit is contained in:
@@ -5,17 +5,8 @@ namespace GeoIP2\Record;
|
||||
class Country extends AbstractPlaceRecord
|
||||
{
|
||||
|
||||
private $languages;
|
||||
|
||||
public function __construct($record, $languages){
|
||||
$this->languages = $languages;
|
||||
parent::__construct($record);
|
||||
}
|
||||
|
||||
public function name() {
|
||||
foreach($this->languages as $language) {
|
||||
if (isset($this->names[$language])) return $this->names[$language];
|
||||
}
|
||||
}
|
||||
|
||||
protected $validAttributes = Array('confidence',
|
||||
'geoname_id',
|
||||
'iso_code',
|
||||
'names');
|
||||
}
|
||||
Reference in New Issue
Block a user