getNameForCategory() public static method

public static getNameForCategory ( integer $category ) : string
$category integer
return string The name of the category
Example #1
0
 /** @param IssueInstance $instance */
 public function print(IssueInstance $instance)
 {
     $this->messages[] = ['type' => 'issue', 'check_name' => $instance->getIssue()->getType(), 'description' => Issue::getNameForCategory($instance->getIssue()->getCategory()) . ' ' . $instance->getIssue()->getType() . ' ' . $instance->getMessage(), 'categories' => ['Bug Risk'], 'severity' => self::mapSeverity($instance->getIssue()->getSeverity()), 'location' => ['path' => preg_replace('/^\\/code\\//', '', $instance->getFile()), 'lines' => ['begin' => $instance->getLine(), 'end' => $instance->getLine()]]];
 }
Example #2
0
 /** @param IssueInstance $instance */
 public function print(IssueInstance $instance)
 {
     fputcsv($this->stream, [$instance->getFile(), $instance->getLine(), $instance->getIssue()->getSeverity(), $instance->getIssue()->getSeverityName(), Issue::getNameForCategory($instance->getIssue()->getCategory()), $instance->getIssue()->getType(), $instance->getMessage()]);
 }
Example #3
0
File: Log.php Project: actank/phan
 public static function display(array $summary = [])
 {
     $log = self::getInstance();
     $out = '';
     $print_closure = function (string $message) {
         print $message;
     };
     $fp = null;
     if (!empty($log->output_filename)) {
         $fp = fopen($log->output_filename, "w");
         $print_closure = function ($message) use($fp) {
             fputs($fp, $message);
         };
     } else {
         if (Config::get()->progress_bar) {
             fwrite(STDERR, "\n");
         }
     }
     // Sort messages by file name and line number in
     // ascending order
     ksort($log->msgs);
     switch ($log->output_mode) {
         case 'text':
             foreach ($log->msgs as $e) {
                 $print_closure("{$e['file']}:{$e['lineno']}" . " {$e['type']}" . " {$e['message']}\n");
             }
             break;
         case 'codeclimate':
             foreach ($log->msgs as $e) {
                 $severity = 'info';
                 switch ($e['severity']) {
                     case Issue::SEVERITY_CRITICAL:
                         $severity = 'critical';
                         break;
                     case Issue::SEVERITY_NORMAL:
                         $severity = 'normal';
                         break;
                     case Issue::SEVERITY_LOW:
                         $severity = 'info';
                         break;
                 }
                 $print_closure(json_encode(['type' => 'issue', 'check_name' => $e['type'], 'description' => Issue::getNameForCategory($e['category']) . ' ' . $e['type'] . ' ' . $e['message'], 'categories' => ['Bug Risk'], 'severity' => $severity, 'location' => ['path' => preg_replace('/^\\/code\\//', '', $e['file']), 'lines' => ['begin' => $e['lineno'], 'end' => $e['lineno']]]], JSON_UNESCAPED_SLASHES, JSON_UNESCAPED_UNICODE) . chr(0));
             }
             break;
     }
     $log->msgs = [];
     if ($fp) {
         fclose($fp);
     }
 }