public static function parseHeader(MessageInterface $message, $header)
    {
        static $trimmed = "\"'  \n\t\r";
        $params = $matches = [];

        foreach (self::normalizeHeader($message, $header) as $val) {
            $part = [];
            foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) {
                if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) {
                    $m = $matches[0];
                    if (isset($m[1])) {
                        $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed);
                    } else {
                        $part[] = trim($m[0], $trimmed);
                    }
                }
            }
            if ($part) {
                $params[] = $part;
            }
        }

        return $params;
    }
public static function parseHeader(MessageInterface $message, $header)
    {
        static $trimmed = "\"'  \n\t\r";
        $params = $matches = [];

        foreach (self::normalizeHeader($message, $header) as $val) {
            $part = [];
            foreach (preg_split('/;(?=([^"]*"[^"]*")*[^"]*$)/', $val) as $kvp) {
                if (preg_match_all('/<[^>]+>|[^=]+/', $kvp, $matches)) {
                    $m = $matches[0];
                    if (isset($m[1])) {
                        $part[trim($m[0], $trimmed)] = trim($m[1], $trimmed);
                    } else {
                        $part[] = trim($m[0], $trimmed);
                    }
                }
            }
            if ($part) {
                $params[] = $part;
            }
        }

        return $params;
    }
public static function parseHeader ( MessageInterface $ message , $ header ) { static $ trimmed = "\"'  \n\t\r" ; $ params = $ matches = [ ] ; foreach ( self :: normalizeHeader ( $ message , $ header ) as $ val ) { $ part = [ ] ; foreach ( preg_split ( '/;(?=([^"]*"[^"]*")*[^"]*$)/' , $ val ) as $ kvp ) { if ( preg_match_all ( '/<[^>]+>|[^=]+/' , $ kvp , $ matches ) ) { $ m = $ matches [ 0 ] ; if ( isset ( $ m [ 1 ] ) ) { $ part [ trim ( $ m [ 0 ] , $ trimmed ) ] = trim ( $ m [ 1 ] , $ trimmed ) ; } else { $ part [ ] = trim ( $ m [ 0 ] , $ trimmed ) ; } } } if ( $ part ) { $ params [ ] = $ part ; } } return $ params ; }
Parse an array of header values containing ";" separated data into an
array of associative arrays representing the header key value pair
data of the header. When a parameter does not contain a value, but just
contains a key, this function will inject a key with a '' string value.

@param MessageInterface $message That contains the header
@param string           $header  Header to retrieve from the message

@return array Returns the parsed header values.
Parse an array of header values containing ; separated data into an array of associative arrays representing the header key value pair data of the header . When a parameter does not contain a value but just contains a key this function will inject a key with a string value .