From fc3e67969d555cc026118349ae2761a455bf5a96 Mon Sep 17 00:00:00 2001 From: Gregory Oschwald Date: Wed, 8 May 2013 07:20:30 -0700 Subject: [PATCH] Make 'name' a property rather than a function --- src/GeoIP2/Record/AbstractPlaceRecord.php | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/GeoIP2/Record/AbstractPlaceRecord.php b/src/GeoIP2/Record/AbstractPlaceRecord.php index 54800d1..91ac51c 100644 --- a/src/GeoIP2/Record/AbstractPlaceRecord.php +++ b/src/GeoIP2/Record/AbstractPlaceRecord.php @@ -11,7 +11,16 @@ abstract class AbstractPlaceRecord extends AbstractRecord parent::__construct($record); } - public function name() { + public function __get($attr) { + if ($attr == 'name') { + return $this->name(); + } else { + return parent::__get($attr); + } + } + + + private function name() { foreach($this->languages as $language) { if (isset($this->names[$language])) return $this->names[$language]; }