<?php
namespace jd_vop\response\area;
use jd_vop\response\Result;
class GetJDAddressFromAddress implements Result
{
public $nation_id;
public $nation;
public $province_id;
public $province;
public $city_id;
public $city;
public $county_id;
public $county;
public $town_id;
public $town;
public function __construct(string $nation_id, string $nation, int $province_id, string $province, int $city_id, string $city, int $county_id, string $county, int $town_id, string $town)
{
$this->nation_id = $nation_id;
$this->nation = $nation;
$this->province_id = $province_id;
$this->province = $province;
$this->city_id = $city_id;
$this->city = $city;
$this->county_id = $county_id;
$this->county = $county;
$this->town_id = $town_id;
$this->town = $town;
}
public static function parse($result): self
{
$nation_id = $result['nationId'] ?? 0;
$nation = $result['nation'] ?? "";
$province_id = $result['provinceId'] ?? 0;
$province = $result['province'] ?? "";
$city_id = $result['cityId'] ?? 0;
$city = $result['city'] ?? "";
$county_id = $result['countyId'] ?? 0;
$county = $result['county'] ?? "";
$town_id = $result['townId'] ?? 0;
$town = $result['town'] ?? "";
return new self($nation_id, $nation, $province_id, $province, $city_id, $city, $county_id, $county, $town_id, $town);
}
}