public function __construct(Request &$request, $matchs) { $path = 'Controller' . DIRECTORY_SEPARATOR; if (isset($matchs['directory'])) { $path = $path . $matchs['directory'] . DIRECTORY_SEPARATOR; } $path = $path . $matchs['controller']; $method = 'action_' . $matchs['action']; $class = str_replace(DIRECTORY_SEPARATOR, '_', $path); $refObject = new ReflectionClass($class); if ($refObject->getParentClass()->getName() != 'Controller') { throw new Ada_Exception("The requested URL " . self::$uri . " was not found on this server"); } $refMethod = new ReflectionMethod($class, $method); if ($refMethod->ispublic()) { ob_start(); $refMethod->invokeArgs(new $class(), isset($matchs['params']) ? $matchs['params'] : array()); $request->response->body(ob_get_contents()); ob_end_clean(); } else { throw new Ada_Exception("The requested URL " . self::$uri . " was not found on this server"); } unset($refMethod, $path, $method, $class); }