protected function _loadInstanceList(\SimpleXMLElement $sxml)
{
$list = new InstanceList();
$list->setEc2($this->ec2);
if (!empty($sxml->item)) {
foreach ($sxml->item as $v) {
$instanceId = (string) $v->instanceId;
$item = $this->ec2->getEntityManagerEnabled() ? $this->ec2->instance->get($instanceId) : null;
if ($item === null) {
$item = new InstanceData();
$item->setEc2($this->ec2);
$bAttach = true;
} else {
$item->resetObject();
$bAttach = false;
}
$item->instanceId = $instanceId;
$item->imageId = $this->exist($v->imageId) ? (string) $v->imageId : null;
$item->privateDnsName = (string) $v->privateDnsName;
$item->dnsName = $this->exist($v->dnsName) ? (string) $v->dnsName : null;
$item->reason = $this->exist($v->reason) ? (string) $v->reason : null;
$item->keyName = $this->exist($v->keyName) ? (string) $v->keyName : null;
$item->amiLaunchIndex = $this->exist($v->amiLaunchIndex) ? (string) $v->amiLaunchIndex : null;
$item->instanceType = (string) $v->instanceType;
$item->launchTime = new DateTime((string) $v->launchTime, new DateTimeZone('UTC'));
$item->kernelId = $this->exist($v->kernelId) ? (string) $v->kernelId : null;
$item->ramdiskId = $this->exist($v->ramdiskId) ? (string) $v->ramdiskId : null;
$item->platform = $this->exist($v->platform) ? (string) $v->platform : null;
$item->subnetId = $this->exist($v->subnetId) ? (string) $v->subnetId : null;
$item->vpcId = $this->exist($v->vpcId) ? (string) $v->vpcId : null;
$item->privateIpAddress = $this->exist($v->privateIpAddress) ? (string) $v->privateIpAddress : null;
$item->ipAddress = $this->exist($v->ipAddress) ? (string) $v->ipAddress : null;
$item->sourceDestCheck = $this->exist($v->sourceDestCheck) ? (string) $v->sourceDestCheck == 'true' : null;
$item->architecture = $this->exist($v->architecture) ? (string) $v->architecture : null;
$item->rootDeviceType = $this->exist($v->rootDeviceType) ? (string) $v->rootDeviceType : null;
$item->rootDeviceName = $this->exist($v->rootDeviceName) ? (string) $v->rootDeviceName : null;
$item->instanceLifecycle = $this->exist($v->instanceLifecycle) ? (string) $v->instanceLifecycle : null;
$item->spotInstanceRequestId = $this->exist($v->spotInstanceRequestId) ? (string) $v->spotInstanceRequestId : null;
$item->virtualizationType = $this->exist($v->virtualizationType) ? (string) $v->virtualizationType : null;
$item->clientToken = $this->exist($v->clientToken) ? (string) $v->clientToken : null;
$item->hypervisor = $this->exist($v->hypervisor) ? (string) $v->hypervisor : null;
$item->ebsOptimized = $this->exist($v->ebsOptimized) ? (string) $v->ebsOptimized == 'true' : null;
$item->sriovNetSupport = $this->exist($v->sriovNetSupport) ? (string) $v->sriovNetSupport : null;
$item->setInstanceState($this->_loadInstanceStateData($v->instanceState))->setProductCodes($this->_loadProductCodeSetList($v->productCodes))->setPlacement($this->_loadPlacementResponseData($v->placement))->setMonitoring($this->_loadInstanceMonitoringStateData($v->monitoring))->setGroupSet($this->_loadGroupList($v->groupSet))->setStateReason($this->_loadStateReasonData($v->stateReason))->setBlockDeviceMapping($this->_loadInstanceBlockDeviceMappingResponseList($v->blockDeviceMapping))->setTagSet($this->_loadResourceTagSetList($v->tagSet))->setNetworkInterfaceSet($this->_loadInstanceNetworkInterfaceSetList($v->networkInterfaceSet))->setIamInstanceProfile($this->_loadIamInstanceProfileResponseData($v->iamInstanceProfile));
$list->append($item);
if ($bAttach && $this->ec2->getEntityManagerEnabled()) {
$this->getEntityManager()->attach($item);
}
unset($item);
}
}
return $list;
}