$record * @param list $locales */ public function __construct(array $record, array $locales = ['en']) { parent::__construct($record, $locales); $this->code = $record['code'] ?? null; $this->geonameId = $record['geoname_id'] ?? null; } /** * @return array */ public function jsonSerialize(): array { $js = parent::jsonSerialize(); if ($this->code !== null) { $js['code'] = $this->code; } if ($this->geonameId !== null) { $js['geoname_id'] = $this->geonameId; } return $js; } }