/** * Handle this request and render any content * @param IRequest $Request the IRequest inst for this render * @return bool returns true if the route was rendered, false if no route was matched */ static function route(IRequest $Request = null) { if (!$Request) { $Request = Request::create(); } $Renderer = new RouteRenderer($Request); $Index = new SiteMap(); return $Renderer->renderRoutes($Index); }
<?php use CPath\Render\Text\TextMimeType; use CPath\Request\Request; $_SERVER['REQUEST_METHOD'] = 'CLI'; require_once 'Processor/SiteMap.php'; $Request = Request::create('/cpath/build', array(), new TextMimeType()); $Build = new \CPath\Build\Handlers\BuildRequestHandler(); $Response = $Build->execute($Request); echo $Response->getMessage(); //CPathMap::route($Request);
<?php use CPath\Request\Request; use CPath\Route\CPathMap; require_once 'Processor/SiteMap.php'; $Request = Request::create('CLI /cpath/test', array(), new \CPath\Render\Text\TextMimeType()); //$Request->setMimeType(new TextMimeType()); CPathMap::route($Request);