Ejemplo n.º 1
0
 /**
  * Runs the application by retrieving and calling the method for the current action.
  *
  * @author Yorick Peterse
  * @return void
  */
 public function run()
 {
     if (empty($this->mappings)) {
         throw new Exception\MappingException("No methods have been mapped to any URL");
     }
     // Set the PATH_INFO based on the CLI arguments.
     if (defined('KOI_DEBUG') != TRUE and PHP_SAPI === 'cli') {
         $_SERVER['PATH_INFO'] = CLI::uri();
     }
     // Route the call
     $result = Router::route($this->mappings);
     if ($result === FALSE) {
         throw new Exception\MappingException("No methods have been bound to {$_SERVER['PATH_INFO']}");
     }
     $this->render($result['body'], $result['status'], $result['content_type']);
 }