protected function findContentTypeInHeaders($headers)
    {

        foreach ($headers as $header) {

            $lower = trim(strtolower($header));

            if (strpos($lower, 'content-type:') !== 0) {
                continue;
            }

            $parts = explode(';', $header);

            $keyAndValue = explode(': ', trim($parts[0]), 2);

            if (!isset($keyAndValue[1])) {
                continue;
            }

            return trim($keyAndValue[1]);

        }

        return '';
    }
protected function findContentTypeInHeaders($headers)
    {

        foreach ($headers as $header) {

            $lower = trim(strtolower($header));

            if (strpos($lower, 'content-type:') !== 0) {
                continue;
            }

            $parts = explode(';', $header);

            $keyAndValue = explode(': ', trim($parts[0]), 2);

            if (!isset($keyAndValue[1])) {
                continue;
            }

            return trim($keyAndValue[1]);

        }

        return '';
    }
protected function findContentTypeInHeaders ( $ headers ) { foreach ( $ headers as $ header ) { $ lower = trim ( strtolower ( $ header ) ) ; if ( strpos ( $ lower , 'content-type:' ) !== 0 ) { continue ; } $ parts = explode ( ';' , $ header ) ; $ keyAndValue = explode ( ': ' , trim ( $ parts [ 0 ] ) , 2 ) ; if ( ! isset ( $ keyAndValue [ 1 ] ) ) { continue ; } return trim ( $ keyAndValue [ 1 ] ) ; } return '' ; }
Tries to find the content type in the assigned headers.

@param $headers

@return string
Tries to find the content type in the assigned headers .