class Markdown in Site Audit 8.3
Hierarchy
- class \Drupal\site_audit\Renderer uses StringTranslationTrait
- class \Drupal\site_audit\Renderer\Markdown
Expanded class hierarchy of Markdown
1 file declares its use of Markdown
- SiteAuditCommands.php in src/
Commands/ SiteAuditCommands.php
File
- src/
Renderer/ Markdown.php, line 11
Namespace
Drupal\site_audit\RendererView source
class Markdown extends Renderer {
/**
*
*/
public function render($detail = FALSE) {
$ret_val = '## ' . $this->report
->getLabel();
$percent = $this->report
->getPercent();
if ($percent != Check::AUDIT_CHECK_SCORE_INFO) {
$ret_val .= ': ' . $percent . '%';
}
else {
$ret_val .= ': ' . $this
->t('Info');
}
$ret_val .= str_repeat(PHP_EOL, 2);
if ($percent == 100) {
$ret_val .= '*' . $this
->t('Well done!') . '* ';
$ret_val .= $this
->t('No action required.');
$ret_val .= PHP_EOL;
}
if ($detail || $percent != 100) {
foreach ($this->report
->getChecks() as $check) {
$score = $check
->getScore();
if ($detail || $score < Check::AUDIT_CHECK_SCORE_PASS || $percent == Check::AUDIT_CHECK_SCORE_INFO) {
// Heading.
$ret_val .= '### ' . $check
->getLabel() . PHP_EOL;
if ($detail) {
$ret_val .= '* _' . $check
->getDescription() . '_' . PHP_EOL;
}
$ret_val .= PHP_EOL;
// Result.
$result = $check
->getResult();
// Table.
if (is_array($result)) {
$ret_val .= '|' . implode('|', $result['headers']) . '|' . PHP_EOL;
$ret_val .= str_repeat('|--', count($result['headers'])) . '|' . PHP_EOL;
foreach ($result['rows'] as $row) {
$ret_val .= '|`' . implode('`|`', $row) . '`|' . PHP_EOL;
}
$ret_val .= PHP_EOL;
}
else {
$ret_val .= $result;
}
// Action.
if ($check
->renderAction()) {
$ret_val .= str_repeat(PHP_EOL, 2);
$ret_val .= $check
->renderAction();
}
$ret_val .= PHP_EOL;
}
}
}
$ret_val .= "\n";
return $ret_val;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
Markdown:: |
public | function |
Overrides Renderer:: |
|
Renderer:: |
public | property | The logger we are using for output. | |
Renderer:: |
public | property | Any options that have been passed in. | |
Renderer:: |
public | property | Output interface. | 1 |
Renderer:: |
public | property | The Report to be rendered. | |
Renderer:: |
public | function | 2 | |
StringTranslationTrait:: |
protected | property | The string translation service. | 1 |
StringTranslationTrait:: |
protected | function | Formats a string containing a count of items. | |
StringTranslationTrait:: |
protected | function | Returns the number of plurals supported by a given language. | |
StringTranslationTrait:: |
protected | function | Gets the string translation service. | |
StringTranslationTrait:: |
public | function | Sets the string translation service to use. | 2 |
StringTranslationTrait:: |
protected | function | Translates a string to the current language or to a given language. |