public function dispatch(Request $request, $result)
    {
        foreach ($request->getAcceptableContentTypes() as $mimeType) {
            /** @var \eZ\Publish\Core\REST\Common\Output\Visitor $visitor */
            foreach ($this->mapping as $regexp => $visitor) {
                if (preg_match($regexp, $mimeType)) {
                    return $visitor->visit($result);
                }
            }
        }

        throw new RuntimeException('No view mapping found.');
    }
public function dispatch(Request $request, $result)
    {
        foreach ($request->getAcceptableContentTypes() as $mimeType) {
            /** @var \eZ\Publish\Core\REST\Common\Output\Visitor $visitor */
            foreach ($this->mapping as $regexp => $visitor) {
                if (preg_match($regexp, $mimeType)) {
                    return $visitor->visit($result);
                }
            }
        }

        throw new RuntimeException('No view mapping found.');
    }
public function dispatch ( Request $ request , $ result ) { foreach ( $ request -> getAcceptableContentTypes ( ) as $ mimeType ) { /** @var \eZ\Publish\Core\REST\Common\Output\Visitor $visitor */ foreach ( $ this -> mapping as $ regexp => $ visitor ) { if ( preg_match ( $ regexp , $ mimeType ) ) { return $ visitor -> visit ( $ result ) ; } } } throw new RuntimeException ( 'No view mapping found.' ) ; }
Dispatches a visitable result to the mapped visitor.

@param \Symfony\Component\HttpFoundation\Request $request
@param mixed $result

@throws RuntimeException

@return Response
Dispatches a visitable result to the mapped visitor .