1: <?php
2:
3: namespace GeoIp2\Record;
4:
5: abstract class AbstractPlaceRecord extends AbstractRecord
6: {
7: private $languages;
8:
9: /**
10: * @ignore
11: */
12: public function __construct($record, $languages)
13: {
14: $this->languages = $languages;
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->languages as $language) {
33: if (isset($this->names[$language])) {
34: return $this->names[$language];
35: }
36: }
37: }
38: }
39: