public static function fromException(\Exception $ex, File $file)
 {
     $message = 'An error occurred while analyzing "' . $file->getName() . '": ' . $ex->getMessage();
     $ex = new self($message, (int) $ex->getCode(), $ex);
     $ex->setAnalyzedFile($file);
     return $ex;
 }
Example #2
0
 /**
  * @param \Throwable $instance Exception or Error instance
  * @throws Error
  */
 public static function handleUncaughtException($instance)
 {
     @ob_end_clean();
     if (Database::getInstance() && Database::getInstance()->inTransaction()) {
         Database::getInstance()->rollBack();
     }
     if (!$instance instanceof Error) {
         $instance = new self($instance->getMessage(), intval($instance->getCode()), $instance, $instance->getTrace());
     } elseif ($instance->getCode()) {
         \Helper\Utils::send_http_status($instance->getCode());
     }
     Template::setView('Misc/Error');
     Template::putContext('instance', $instance);
     Filter::preRender();
     Template::render();
     Filter::afterRender();
     exit;
 }
Example #3
0
 public static function handleUncaughtException(\Exception $instance)
 {
     @ob_end_clean();
     if (Database::inTransaction()) {
         Database::rollBack();
     }
     if (!$instance instanceof Error) {
         $instance = new self($instance->getMessage(), intval($instance->getCode()), $instance, $instance->getTrace());
     }
     include Template::load('Misc/Error');
     exit;
 }
Example #4
0
 /**
  * Helper function to instantiate this class and get the generated code.
  *
  * @param string $url   WSDL URL
  * @param string $sname Service class name.
  * @param string $tab   Indentation character(s).
  *
  * @return string
  */
 public static function generate($url, $sname, $tab = '    ')
 {
     $class = new self($url, $sname, $tab);
     return $class->getCode();
 }
Example #5
0
 public function includeFile($filename)
 {
     $contents = file_get_contents($filename);
     $compiler = new self($contents);
     $compiler->fetchIncludes();
     return $compiler->getCode();
 }