示例#1
0
 protected function runScript(core\request $path)
 {
     $sResult = '';
     $bProfile = $this->readArgument('debug/profile');
     if ($bProfile) {
         $profiler = $this->create('profiler');
         $profiler->start();
         //xdebug_start_code_coverage(XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE);
     }
     $sExtension = $path->parseExtension(true);
     if ($sExtension == $this->readArgument('redirect/extension')) {
         $path->parse();
         $redirect = $this->prepareScript($path->asFile(), $path->getArguments());
         if (!$redirect instanceof core\redirect) {
             $this->throwException('Cannot redirect at that adress');
         }
         $this->runRedirect($redirect);
     } else {
         if (in_array($sExtension, $this->query('executables'))) {
             $sResult = $this->runExecutable($path);
         } else {
             if (!$path->getExtension()) {
                 $builder = $this->createWindowBuilder();
                 $sResult = $builder->buildWindow($path, $this->get('window'), $this->read('debug/update', false), $this->read('debug/run'));
             } else {
                 $this->throwException('No valid window defined');
             }
         }
     }
     if ($bProfile) {
         $profiler->stop();
         $profiler->save();
         /*
              $data = xdebug_get_code_coverage();
              xdebug_stop_code_coverage();
         
              //print_r($data);
         */
     }
     return $sResult;
 }