protected function getAcceptHeader(Request $request): Accept
	{
		$headerName = 'Accept';
		$headerLine = '*/*';
		if ($request->hasHeader($headerName))
		{
			$headerLine = $request->getHeaderLine($headerName);
		}
		try
		{
			return Accept::fromString($headerName . ': ' . $headerLine);
		}
		catch (\Exception $e)
		{
			throw new Exception\BadRequest('Invalid Accept header', $e);
		}
	}
protected function getAcceptHeader(Request $request): Accept
	{
		$headerName = 'Accept';
		$headerLine = '*/*';
		if ($request->hasHeader($headerName))
		{
			$headerLine = $request->getHeaderLine($headerName);
		}
		try
		{
			return Accept::fromString($headerName . ': ' . $headerLine);
		}
		catch (\Exception $e)
		{
			throw new Exception\BadRequest('Invalid Accept header', $e);
		}
	}
protected function getAcceptHeader ( Request $ request ) : Accept { $ headerName = 'Accept' ; $ headerLine = '*/*' ; if ( $ request -> hasHeader ( $ headerName ) ) { $ headerLine = $ request -> getHeaderLine ( $ headerName ) ; } try { return Accept :: fromString ( $ headerName . ': ' . $ headerLine ) ; } catch ( \ Exception $ e ) { throw new Exception \ BadRequest ( 'Invalid Accept header' , $ e ) ; } }
Makes Accept header object from PSR-7 request
@param Request $request
@return Accept
@throws Exception\BadRequest
Makes Accept header object from PSR - 7 request