protected function parse(array $list)
    {
        $parsed = array();

        foreach ($list as $item) {
            $item = explode(';', trim($item));

            $entry = array(
                'encoding' => array_shift($item),
                'q' => 1
            );

            foreach ($item as $param) {
                $param = explode('=', $param);

                // ignore malformed params
                if (count($param) != 2) {
                    continue;
                }

                $entry[$param[0]] = $param[1];
            }

            $parsed[] = $entry;
        }

        return $parsed;
    }
protected function parse(array $list)
    {
        $parsed = array();

        foreach ($list as $item) {
            $item = explode(';', trim($item));

            $entry = array(
                'encoding' => array_shift($item),
                'q' => 1
            );

            foreach ($item as $param) {
                $param = explode('=', $param);

                // ignore malformed params
                if (count($param) != 2) {
                    continue;
                }

                $entry[$param[0]] = $param[1];
            }

            $parsed[] = $entry;
        }

        return $parsed;
    }
protected function parse ( array $ list ) { $ parsed = array ( ) ; foreach ( $ list as $ item ) { $ item = explode ( ';' , trim ( $ item ) ) ; $ entry = array ( 'encoding' => array_shift ( $ item ) , 'q' => 1 ) ; foreach ( $ item as $ param ) { $ param = explode ( '=' , $ param ) ; // ignore malformed params if ( count ( $ param ) != 2 ) { continue ; } $ entry [ $ param [ 0 ] ] = $ param [ 1 ] ; } $ parsed [ ] = $ entry ; } return $ parsed ; }
Parses a list of media types out into a normalised structure.

@param  array $list
@return array
Parses a list of media types out into a normalised structure .