/** * Function to display error in GCC style. * @param Array $errors * @param String $customErrorMessage */ public static function displayGCCStyleOutput($errors) { require_once __DIR__ . '/../libs/core/functions.php'; foreach ($errors as $listoferrors) { foreach ($listoferrors['result'] as $individualErrors) { if (count($individualErrors) == 0) { continue; } $file = $listoferrors['file']; $line = $individualErrors["LINE"]; $content = $individualErrors["CONTENT"]; $errorType = $individualErrors["ERROR"]; $errorMessage = Scanner::getErrorMessage($errorType); $errorNature = $individualErrors["TYPE"]; echof("?:?:?:?:\t?\n?\n\n", $errorNature, $file, $line, $errorType, $content, $errorMessage); } } }
/** * Serve some data to the client * @param String $Data * @param String $OutputFilename * @return boolean */ public static function serveData($Data, $OutputFilename) { $Filename = $OutputFilename; header("Content-type: " . DownloadManager::MIME($Filename)); //get the file type. header('Content-disposition: attachment; filename=' . $Filename); //add attachment; here to force download header('Content-length: ' . strlen($Data)); //specify the browser the length of data it must expect. echof($Data); flush(); return true; }
/** * Dumps an exception in readable format * @param Exception $e */ public static function dump(Exception $e) { echof($e->getTraceAsString()); }