function SettingsForm::demonstrateErrorHandlers

Same name and namespace in other branches
  1. 5.x src/Form/SettingsForm.php \Drupal\devel\Form\SettingsForm::demonstrateErrorHandlers()

Demonstrates the capabilities of the error handler.

Parameters

string $severity: The severity level for which demonstrate the error handler capabilities.

1 call to SettingsForm::demonstrateErrorHandlers()
SettingsForm::buildForm in src/Form/SettingsForm.php
Form constructor.

File

src/Form/SettingsForm.php, line 206

Class

SettingsForm
Defines a form that configures devel settings.

Namespace

Drupal\devel\Form

Code

protected function demonstrateErrorHandlers($severity) {
  switch ($severity) {
    case 'notice':
      trigger_error('This is an example notice', E_USER_NOTICE);
      break;

    case 'warning':
      trigger_error('This is an example notice', E_USER_NOTICE);
      trigger_error('This is an example warning', E_USER_WARNING);
      break;

    case 'error':
      trigger_error('This is an example notice', E_USER_NOTICE);
      trigger_error('This is an example warning', E_USER_WARNING);
      trigger_error('This is an example error', E_USER_ERROR);
      break;

  }
}