Moodle PHP Documentation 4.5
Moodle 4.5dev (Build: 20240606) (d3ae1391abe)
core\check\result Class Reference

A check object returns a result object. More...

Inheritance diagram for core\check\result:
renderable core\check\access\riskbackup_result core\check\access\riskxss_result

Public Member Functions

 __construct ($status, $summary, $details='')
 Constructor.
 
 export_for_template (\renderer_base $output)
 Export this data so it can be used as the context for a mustache template.
 
 get_details ()
 Get the check detailed info.
 
 get_ref ()
 Get the check reference label.
 
 get_status ()
 Get the check status.
 
 get_summary ()
 Summary of the check.
 
 get_template_name ()
 Which mustache template?
 

Public Attributes

const CRITICAL = 'critical'
 This is used to notify if a check is a major critical issue.
 
const ERROR = 'error'
 This is used to notify if a check failed.
 
const INFO = 'info'
 This is used to show info for a check.
 
const NA = 'na'
 This is used to notify if a check does not apply.
 
const OK = 'ok'
 Ideally all checks should be ok.
 
const UNKNOWN = 'unknown'
 This means we could not determine the state.
 
const WARNING = 'warning'
 Warnings.
 

Protected Attributes

string $details = ''
 details about check.
 
string $status = self::UNKNOWN
 $status - status
 
string $summary = ''
 summary - should be roughly 1 line of plain text and may change depending on the state.
 

Detailed Description

A check object returns a result object.

Most checks can use this an instance of this directly but if you have a 'details' which is computationally expensive then extend this and overide the get_details() method so that it is only called when it will be needed.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core\check\result::__construct ( $status,
$summary,
$details = '' )

Constructor.

Parameters
string$statuscode
string$summarya 1 liner summary
string$detailsas a html chunk

Member Function Documentation

◆ export_for_template()

core\check\result::export_for_template ( \renderer_base $output)

Export this data so it can be used as the context for a mustache template.

Parameters
renderer_base$outputtypically, the renderer that's calling this function
Return values
arraydata context for a mustache template

◆ get_details()

core\check\result::get_details ( )

Get the check detailed info.

Return values
stringformatted html

Reimplemented in core\check\access\riskbackup_result, and core\check\access\riskxss_result.

◆ get_ref()

core\check\result::get_ref ( )

Get the check reference label.

Return values
stringmust be globally unique

◆ get_status()

core\check\result::get_status ( )

Get the check status.

Return values
stringone of the consts eg result\OK

◆ get_summary()

core\check\result::get_summary ( )

Summary of the check.

Return values
stringformatted html

◆ get_template_name()

core\check\result::get_template_name ( )

Which mustache template?

Return values
stringpath to mustache template

Member Data Documentation

◆ $details

string core\check\result::$details = ''
protected

details about check.

This may be a large amount of preformatted html text, possibly describing all the different states and actions to address them.

◆ CRITICAL

const core\check\result::CRITICAL = 'critical'

This is used to notify if a check is a major critical issue.

An error which is affecting everyone in a major way.

◆ ERROR

const core\check\result::ERROR = 'error'

This is used to notify if a check failed.

Something is wrong with a component and a feature is not working.

◆ INFO

const core\check\result::INFO = 'info'

This is used to show info for a check.

This is equivalent to OK but could be used for alerting to potential future warnings such as a deprecation in a service.

◆ NA

const core\check\result::NA = 'na'

This is used to notify if a check does not apply.

In most cases if a check doesn't apply a check object shouldn't be made. This state exists for when you always want visibilty of the check itself. Can be useful for a check which depends on another check and it helps focus on the other check which matters more.

◆ UNKNOWN

const core\check\result::UNKNOWN = 'unknown'

This means we could not determine the state.

An example might be an expensive check done via cron, and it has never run. It would be prudent to consider an unknown check as a warning or error.

◆ WARNING

const core\check\result::WARNING = 'warning'

Warnings.

Something is not ideal and should be addressed, eg usability or the speed of the site may be affected, but it may self heal (eg a load spike)


The documentation for this class was generated from the following file: