forked from php-censor/php-censor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherrors.phtml
More file actions
48 lines (43 loc) · 1.48 KB
/
Copy patherrors.phtml
File metadata and controls
48 lines (43 loc) · 1.48 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
use PHPCensor\Helper\Lang;
use PHPCensor\Model\Build;
use PHPCensor\Model\BuildError;
use PHPCensor\Helper\Template;
/**
* @var Build $build
* @var BuildError[] $errors
*/
$linkTemplate = $build->getFileLinkTemplate();
foreach ($errors as $error):
$link = str_replace('{BASEFILE}', basename($error->getFile()), $linkTemplate);
$link = str_replace('{FILE}', $error->getFile(), $link);
$link = str_replace('{LINE}', $error->getLineStart(), $link);
$link = str_replace('{LINE_END}', $error->getLineEnd(), $link);
?>
<tr>
<td>
<?php if ($error->getIsNew()): ?>
<span class="label label-danger"><?= Lang::get('new'); ?></span>
<?php endif; ?>
</td>
<td>
<span class="label label-<?= $error->getSeverityClass(); ?>">
<?= Lang::get($error->getSeverityString()); ?>
</span>
</td>
<td><?= Lang::get($error->getPlugin()); ?></td>
<td><a href="<?= $link; ?>"><?= $error->getFile(); ?></a></td>
<td>
<a href="<?= $link; ?>">
<?php
if ($error->getLineStart() == $error->getLineEnd() || !$error->getLineEnd()) {
echo $error->getLineStart();
} else {
echo ($error->getLineStart() . ' - ' . $error->getLineEnd());
}
?>
</a>
</td>
<td class="visible-line-breaks"><?= Template::clean(trim($error->getMessage())); ?></td>
</tr>
<?php endforeach; ?>