Map any headers found onto each element in the data

@param array $current

@return array
979552
public function mapHeaders(array $current)
    {
        if (count($this->headerRow) > 0) {
            if (count($this->headerRow) !== count($current)) {
                throw new RuntimeException(
                    "The number of entries in: " . implode(',', $current) .
                    " does not match the header: " . implode(',', $this->headerRow)
                );
            }
            return array_combine(
                $this->headerRow,
                $current
            );
        }
        return $current;
    }
1182849
protected function mapHeaders(array $headers)
    {
        $mappedHeaders = array();
        foreach ($headers as $headerPair) {
            list($name, $value) = $headerPair;
            $mappedHeaders[strtolower($name)] = $value;
        }

        return $mappedHeaders;
    }
1028337
protected function headers($header)
    {
        $lines = explode("\r\n", $header);

        $headers = [];
        foreach ($lines as $line) {
            $key = explode(':', $line)[0];
            $value = explode(':', $line)[1];
            $headers[$key] = $value;
        }

        return $headers;
    }
1193374
protected function currentPictures($current)
	{
		if (is_string($current) || is_null($current) || count($current) == 0){
			return ['id' => null, 'path' => $current];
		}

		return $current->map(function ($item) {
			$array = [
				'id' => $item['id'],
				'path' => $item['path']
			];

			return $array;
		})->all();
	}
590948
protected function prepareHeaders(array $headers)
    {
        $preparedHeaders = [];

        foreach ($headers as $strName => $varValue) {
            $preparedHeaders[] = $strName.': '.$varValue;
        }

        return $preparedHeaders;
    }
66888
function toArray($crlf = true)
    {
        $headers = array();

        foreach ($this->_headers as $header) {
            $string = $header->__toString();
            $headers[] = $crlf ? $string : rtrim($string);
        }

        return $headers;
    }
1206721
private function getRawHeaders(array $headers)
    {
        $rawHeaders = '';
        foreach ($headers as $key => $value) {
            $rawHeaders .= sprintf("%s: %s\n", $key, is_array($value) ? implode(', ', $value) : $value);
        }
        $rawHeaders .= "\n";

        return $rawHeaders;
    }
1218141
public function headers(): array
    {
        return collect($this->request->getHeaders())->mapWithKeys(function ($values, $header) {
            return [$header => $values[0]];
        })->all();
    }
91471
public function current() : array
    {
        return $this->result->fetch(\PDO::FETCH_ASSOC, \PDO::FETCH_ORI_ABS, $this->pointer);
    }
1042214
public function getHeaders()
    {
        $headers = [];
        $pattern = '#(.*?): (.*?);#i';
        if (preg_match_all($pattern, $this->header, $match)) {
            foreach ($match[1] as $co => $vo) {
                if (!isset($headers[$vo])) {
                    $headers[$vo] = [];
                }
                $headers[$vo][] = $match[2][$co];
            }
        }
        return $headers;
    }
4214
private function parseHeaders($headers)
    {
        $headers_temp = array();

        $requests = explode("\r\n\r\n", $headers);
        // follow eventual redirections
        for ($index = 0; $index < count($requests) - 1; $index++) {

            foreach (explode("\r\n", $requests[$index]) as $i => $line) {
                if ($i === 0)
                    continue;
                list($key, $value) = explode(': ', $line);
                $headers_temp[$index][$key] = $value;
            }
        }
        // gets always the latest response
        $this->headers = end($headers_temp) !== false ? end($headers_temp) : [];
    }
1064099
public function all(): array
    {
        $result = [];
        foreach ($this->headers as $header) {
            $result[$header->getName()] = $header->getValuesAsArray();
        }

        return $result;
    }
1197668
public function useCurrent($current=null)
    {
        if (isset($current)) {
            $this->current = (bool) $current;
            return $this;
        }
        else {
            return $this->current;
        }
    }
704090
private static function fillCurrentHeaders(self $request)
    {
        $headers = [];

        //Native method exists?
        if (function_exists('getallheaders')) {

            //try to use it
            if (($headers = getallheaders()) === false) {
                $headers = [];
            }
        }

        //No header captured yet? Try to get it myself
        if (empty($headers)) {

            /*
             * Based on a user note provided by joyview
             * at http://php.net/manual/en/function.getallheaders.php
             */
            foreach ($_SERVER as $key => $value) {
                if (substr($key, 0, 5) === 'HTTP_') {
                    $newKey = str_replace(' ', '-', ucwords(strtolower(str_replace('_', ' ', substr($key, 5)))));
                    $headers[$newKey] = $value;
                }
            }
        }

        $request->setHeaders($headers);
    }
799028
public function getResponseHeaders():array
    {
        $headers = [];
        foreach ($this->getResponse()->getHeaders() as $header => $values) {
            if (preg_grep('/^'.preg_quote($header, '$/').'/ui', $this->acceptableProxyHeaders)) {
                $headers[$header] = $values;
            }
        }
        return $headers;
    }
1062482
public function get($attr,$current=true)
    {
        if (!$this->_data || !array_key_exists($attr, $this->_data)) {
            return null;
        }
        return Connection::convertToEncoding($current ? $this->_data[$attr] : $this->_prev_data[$attr]);
    }
175856
public static function formatHeadersForCurl(array $headers)
    {
        $curlHeaders = array();

        foreach ($headers as $key => $value) {
            $curlHeaders[] = $key . ': ' . $value;
        }

        return $curlHeaders;
    }