private function match_controller_segment(&$path_segments, &$match_params) { $tmp_segments = $path_segments; do { $controller = join('/', $tmp_segments); if (ActionController::controller_exists($controller)) { $match_params['controller'] = $controller; $path_segments = array_slice($path_segments, count($tmp_segments)); return true; } } while (array_pop($tmp_segments)); throw new ControllerNotMatchedException('No existing controller found matching the given route.'); }