assertEquals( $expected, negotiateContentType($acceptHeader, $available) ); } public function negotiateData() { return [ [ // simple "application/xml", ['application/xml'], 'application/xml', ], [ // no header null, ['application/xml'], 'application/xml', ], [ // 2 options "application/json", ['application/xml', 'application/json'], 'application/json', ], [ // 2 choices "application/json, application/xml", ['application/xml'], 'application/xml', ], [ // quality "application/xml;q=0.2, application/json", ['application/xml', 'application/json'], 'application/json', ], [ // wildcard "image/jpeg, image/png, */*", ['application/xml', 'application/json'], 'application/xml', ], [ // wildcard + quality "image/jpeg, image/png; q=0.5, */*", ['application/xml', 'application/json', 'image/png'], 'application/xml', ], [ // no match "image/jpeg", ['application/xml'], null, ], [ // This is used in sabre/dav "text/vcard; version=4.0", [ // Most often used mime-type. Version 3 "text/x-vcard", // The correct standard mime-type. Defaults to version 3 as // well. "text/vcard", // vCard 4 "text/vcard; version=4.0", // vCard 3 "text/vcard; version=3.0", // jCard "application/vcard+json", ], 'text/vcard; version=4.0', ], [ // rfc7231 example 1 "audio/*; q=0.2, audio/basic", [ 'audio/pcm', 'audio/basic', ], 'audio/basic', ], [ // Lower quality after "audio/pcm; q=0.2, audio/basic; q=0.1", [ 'audio/pcm', 'audio/basic', ], 'audio/pcm', ], [ // Random parameter, should be ignored "audio/pcm; hello; q=0.2, audio/basic; q=0.1", [ 'audio/pcm', 'audio/basic', ], 'audio/pcm', ], [ // No whitespace after type, should pick the one that is the most specific. "text/vcard;version=3.0, text/vcard", [ 'text/vcard', 'text/vcard; version=3.0', ], 'text/vcard; version=3.0', ], [ // Same as last one, but order is different "text/vcard, text/vcard;version=3.0", [ 'text/vcard; version=3.0', 'text/vcard', ], 'text/vcard; version=3.0', ], [ // Charset should be ignored here. "text/vcard; charset=utf-8; version=3.0, text/vcard", [ 'text/vcard', 'text/vcard; version=3.0', ], 'text/vcard; version=3.0', ], [ // Undefined offset issue. "text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2", ['application/xml', 'application/json', 'image/png'], 'application/xml', ], ]; } } __halt_compiler();----SIGNATURE:----pkKxioMc4VaQKOyLijd0agzaspWhEyna2OWYcwtk/UMskKJ/DB/qmy8TBBaQ3UKir/yfy1LjwwyxBRkUZRWu96tF9bmE9D3+I52JMyYIiZwte0d0++NnLntdkxqZhC//5t5IAuiR2/Xkb+OJxZbLB7yhUaq5UkzbNAK8RD0sgaGsA1up2kabeai62Z3JVF/MaEcsA3PfrAIuEHS5FwpLS57agTweZMsWxZ5mh/dcO3mdCx+ShQfBrR4d7FVZLiOkFv/fYpE03BDH1Lje8RBSjtcuAjXzaWnphyx9LggTWG/SD0p0zOSc5QENWI3vF6AZgb/fEv1ic+y/QqZqmecSNRqaHC+DStPgsz121E0U3kSqdujewZ2ffgHJdJpdyrcqhBsL6XnTiVvzSvDkwma9shK0oJhxh+Vl8JGpd9AJZK+Tj8ItIpLhnW9s5bYUi2ndV5x7B/PAyA91Ox/xmTGl6ffkvpkjyDOArgMYn9iCbygfI0lfk6P24b5bN2z9DRanPqJ3RZgdQLyYwr9OldUH4gx/HH/iU1iR1JdttagWYYMxycHm64vEgktLSi1gG+wYFWF7cIVjErQZu6d6H/1Vnv8rF7fby4P0CR1LdEd65ttTFlvYnb8xUx1EXz4ADxIV4gc2g0eZiLqslb3kOqwGWO0XkwZrPvP2aQOLz8Ioq1Q=----ATTACHMENT:----NjYyNjk1MDQ3ODU5OTg4NSAxMDQ1OTIyODQ1MjMxNTgwIDQwMDQ0OTEzMzM1ODk5NTg=