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));
    }
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));
    }
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 ) ) ; }
Parse the accept header on the incoming request. If strict is enabled
then the accept header must be available and must be a valid match.

@param \Illuminate\Http\Request $request
@param bool                     $strict

@throws \Symfony\Component\HttpKernel\Exception\BadRequestHttpException

@return array
Parse the accept header on the incoming request . If strict is enabled then the accept header must be available and must be a valid match .