Example #1
0
 /**
  * Performs an analysis of the given code.
  * 
  * @param string $code the code to analyze
  * @param PC_Engine_Options $options the options
  * @return array the following array: array(
  *  0 => <functions>,
  *  1 => <classes>,
  *  2 => <vars>,
  *  3 => <calls>,
  *  4 => <errors>,
  * )
  */
 protected function analyze($code, $options = null)
 {
     if ($options === null) {
         $options = new PC_Engine_Options();
     }
     $env = new PC_Engine_Env($options);
     $tscanner = new PC_Engine_TypeScannerFrontend($env);
     $tscanner->scan($code);
     $fin = new PC_Engine_TypeFinalizer($env);
     $fin->finalize();
     $stmt = new PC_Engine_StmtScannerFrontend($env);
     $stmt->scan($code);
     return array($env->get_types()->get_functions(), $env->get_types()->get_classes(), $stmt->get_vars(), $env->get_types()->get_calls(), $env->get_errors()->get());
 }