eZ\Bundle\EzPublishRestBundle\Features\Context\RestClient\BuzzDriver::unFormatHeaders PHP Method

unFormatHeaders() protected method

Converts the buzz headers attributes into single lines.
protected unFormatHeaders ( array $headers ) : array
$headers array All headers
return array
    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;
    }