Added most of the attributes for the City model
This commit is contained in:
@@ -5,15 +5,31 @@ namespace GeoIP2\Model;
|
||||
class City extends Country
|
||||
{
|
||||
//XXX use properties
|
||||
public $city;
|
||||
public $location;
|
||||
public $postal;
|
||||
public $subdivisions;
|
||||
private $city;
|
||||
private $location;
|
||||
private $postal;
|
||||
private $subdivisions = Array();
|
||||
|
||||
public function __construct($raw, $language)
|
||||
public function __construct($raw, $languages)
|
||||
{
|
||||
$this->city = new \GeoIP2\Record\City($this->get('city'), $languages);
|
||||
$this->location = new \GeoIP2\Record\Location($this->get('location'));
|
||||
$this->postal = new \GeoIP2\Record\Postal($this->get('postal'));
|
||||
|
||||
parent::__construct($raw, $language);
|
||||
$this->createSubdivisions($raw, $languages);
|
||||
|
||||
parent::__construct($raw, $languages);
|
||||
}
|
||||
|
||||
private function createSubdivisions($raw, $languages) {
|
||||
if(!isset($raw['subdivisions'])) return;
|
||||
|
||||
foreach ($raw['subdivisions'] as $sub) {
|
||||
array_push($this->subdivisions,
|
||||
new \GeoIP2\Record\Subdivision($sub, $languages));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user