1: <?php
2:
3: namespace GeoIp2\Record;
4:
5: abstract class AbstractPlaceRecord extends AbstractRecord
6: {
7: private $locales;
8:
9: /**
10: * @ignore
11: */
12: public function __construct($record, $locales)
13: {
14: $this->locales = $locales;
15: parent::__construct($record);
16: }
17:
18: /**
19: * @ignore
20: */
21: public function __get($attr)
22: {
23: if ($attr == 'name') {
24: return $this->name();
25: } else {
26: return parent::__get($attr);
27: }
28: }
29:
30: private function name()
31: {
32: foreach ($this->locales as $locale) {
33: if (isset($this->names[$locale])) {
34: return $this->names[$locale];
35: }
36: }
37: }
38: }
39: