protected function unFormatHeaders(array $headers)
{
$headersInAssociativeArray = array();
foreach ($headers as $header) {
$colonPosition = strpos($header, ':');
// if no ':' is found than add all header to array
if ($colonPosition === false) {
$headersInAssociativeArray[] = $header;
} else {
$key = strtolower(trim(substr($header, 0, $colonPosition)));
$value = trim(substr($header, $colonPosition + 1, strlen($header)));
$headersInAssociativeArray[$key] = $value;
}
}
return $headersInAssociativeArray;
}