You are here

class Json in Site Audit 8.3

Hierarchy

Expanded class hierarchy of Json

1 file declares its use of Json
SiteAuditCommands.php in src/Commands/SiteAuditCommands.php

File

src/Renderer/Json.php, line 10

Namespace

Drupal\site_audit\Renderer
View source
class Json extends Renderer {

  /**
   *
   */
  public function render($detail = FALSE) {
    $report = [
      'percent' => $this->report
        ->getPercent(),
      'label' => $this->report
        ->getLabel(),
      'checks' => [],
    ];
    foreach ($this->report
      ->getCheckObjects() as $check) {
      $report['checks'][get_class($check)] = [
        'label' => $check
          ->getLabel(),
        'description' => $check
          ->getDescription(),
        'result' => $check
          ->getResult(),
        'action' => $check
          ->renderAction(),
        'score' => $check
          ->getScore(),
      ];
    }
    return json_encode($report);
  }

}

Members

Namesort descending Modifiers Type Description Overrides
Json::render public function Overrides Renderer::render
Renderer::$logger public property The logger we are using for output.
Renderer::$options public property Any options that have been passed in.
Renderer::$output public property Output interface. 1
Renderer::$report public property The Report to be rendered.
Renderer::__construct public function 2
StringTranslationTrait::$stringTranslation protected property The string translation service. 1
StringTranslationTrait::formatPlural protected function Formats a string containing a count of items.
StringTranslationTrait::getNumberOfPlurals protected function Returns the number of plurals supported by a given language.
StringTranslationTrait::getStringTranslation protected function Gets the string translation service.
StringTranslationTrait::setStringTranslation public function Sets the string translation service to use. 2
StringTranslationTrait::t protected function Translates a string to the current language or to a given language.