public function parse(Request $request, $strict = false)
{
$pattern = '/application\\/' . $this->standardsTree . '\\.(' . $this->subtype . ')\\.([\\w\\d\\.\\-]+)\\+([\\w]+)/';
if (!preg_match($pattern, $request->header('accept'), $matches)) {
if ($strict) {
throw new BadRequestHttpException('Accept header could not be properly parsed because of a strict matching process.');
}
$default = 'application/' . $this->standardsTree . '.' . $this->subtype . '.' . $this->version . '+' . $this->format;
preg_match($pattern, $default, $matches);
}
return array_combine(['subtype', 'version', 'format'], array_slice($matches, 1));
}