private function getViewBestMatch(Request $request, $applicationName)
    {
        $best = null;
        
        if (count($this->views[$applicationName]) > 0) {
            foreach ($this->views[$applicationName] as $orderLevel => $views) {
                foreach ($views as $view) {
                    assert($view instanceof View);
                    if ($view->matchBoth($request->getController(), $request->getAction())) {
                        $best[$orderLevel] = $view;
                        continue 2;
                    }
                }
            }
        }
        if (null == $best) {
            throw new ViewException("No view found for request");
        }
        
        if (count($best) > 1) {
            krsort($best);
        }
        
        return reset($best);
    }
private function getViewBestMatch(Request $request, $applicationName)
    {
        $best = null;
        
        if (count($this->views[$applicationName]) > 0) {
            foreach ($this->views[$applicationName] as $orderLevel => $views) {
                foreach ($views as $view) {
                    assert($view instanceof View);
                    if ($view->matchBoth($request->getController(), $request->getAction())) {
                        $best[$orderLevel] = $view;
                        continue 2;
                    }
                }
            }
        }
        if (null == $best) {
            throw new ViewException("No view found for request");
        }
        
        if (count($best) > 1) {
            krsort($best);
        }
        
        return reset($best);
    }
private function getViewBestMatch ( Request $ request , $ applicationName ) { $ best = null ; if ( count ( $ this -> views [ $ applicationName ] ) > 0 ) { foreach ( $ this -> views [ $ applicationName ] as $ orderLevel => $ views ) { foreach ( $ views as $ view ) { assert ( $ view instanceof View ) ; if ( $ view -> matchBoth ( $ request -> getController ( ) , $ request -> getAction ( ) ) ) { $ best [ $ orderLevel ] = $ view ; continue 2 ; } } } } if ( null == $ best ) { throw new ViewException ( "No view found for request" ) ; } if ( count ( $ best ) > 1 ) { krsort ( $ best ) ; } return reset ( $ best ) ; }
Get the best view for request

@param Request $request
The request to get best view for

@return View The view best matched for the request

@throws ViewException
Get the best view for request