public function setParamsByArray($array) { foreach ($array as $regionKey => $regionValue) { if (property_exists($this, $regionKey)) { if (in_array($regionKey, array('ref', 'regionGiataList', 'dstList'))) { if ($regionKey == 'dstList') { $this->{$regionKey} = array(); if (is_array($regionValue)) { foreach ($regionValue as $dstValue) { $dst = new Destination(); $dst->setParamsByArray($dstValue); array_push($this->{$regionKey}, $dst); } } else { $dst = new Destination(); $dst->setParamsByArray($regionValue); array_push($this->{$regionKey}, $dst); } } else { $this->{$regionKey} = explode(' ', $regionValue); } } else { $this->{$regionKey} = $regionValue; } } } }