33 $this->supportedValues = $supported;
34 $this->defaultValue = reset( $supported );
55 foreach ( $weights as $name => &$weight ) {
56 if ( $name ===
'*' || $name ===
'*/*' ) {
58 } elseif ( substr( $name, -2 ) ===
'/*' ) {
67 $weights = array_filter( $weights );
70 $preferences = array_reverse( array_keys( $weights ) );
90 foreach ( $preferences as
$value ) {
91 foreach ( $this->supportedValues as $supported ) {
119 if ( strcasecmp( $accepted, $supported ) === 0 ) {
124 if ( $accepted ===
'*' || $accepted ===
'*/*' ) {
129 if ( substr( $accepted, -2 ) ===
'/*'
130 && strncasecmp( $accepted, $supported, strlen( $accepted ) - 2 ) === 0