Differences Between: [Versions 310 and 311] [Versions 311 and 402] [Versions 311 and 403] [Versions 39 and 311]
1 <?php 2 3 declare(strict_types=1); 4 5 namespace GeoIp2\Record; 6 7 abstract class AbstractPlaceRecord extends AbstractRecord 8 { 9 private $locales; 10 11 /** 12 * @ignore 13 */ 14 public function __construct(?array $record, array $locales = ['en']) 15 { 16 $this->locales = $locales; 17 parent::__construct($record); 18 } 19 20 /** 21 * @ignore 22 */ 23 public function __get(string $attr) 24 { 25 if ($attr === 'name') { 26 return $this->name(); 27 } 28 29 return parent::__get($attr); 30 } 31 32 /** 33 * @ignore 34 */ 35 public function __isset(string $attr): bool 36 { 37 if ($attr === 'name') { 38 return $this->firstSetNameLocale() !== null; 39 } 40 41 return parent::__isset($attr); 42 } 43 44 private function name(): ?string 45 { 46 $locale = $this->firstSetNameLocale(); 47 48 return $locale === null ? null : $this->names[$locale]; 49 } 50 51 private function firstSetNameLocale(): ?string 52 { 53 foreach ($this->locales as $locale) { 54 if (isset($this->names[$locale])) { 55 return $locale; 56 } 57 } 58 59 return null; 60 } 61 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body