You are here

protected function Dbug::error in dBug for Drupal 8

Same name and namespace in other branches
  1. 2.0.x src/Dbug.php \Drupal\dbug\Dbug::error()
  2. 1.0.x src/Dbug.php \Drupal\dbug\Dbug::error()

Error.

Parameters

string $type: The error type.

Return value

string The error description.

3 calls to Dbug::error()
Dbug::varIsArray in src/Dbug.php
If variable is an array type.
Dbug::varIsObject in src/Dbug.php
If variable is an object type.
Dbug::varIsXmlResource in src/Dbug.php
If variable is an xml resource type.

File

src/Dbug.php, line 300

Class

Dbug
Implementation of dBug for Drupal.

Namespace

Drupal\dbug

Code

protected function error($type) {
  $error = "Error: Variable cannot be a";

  // This just checks if the type starts with a vowel or "x" and displays
  // either "a" or "an".
  if (in_array(substr($type, 0, 1), [
    "a",
    "e",
    "i",
    "o",
    "u",
    "x",
  ])) {
    $error .= "n";
  }
  return $error . " " . $type . " type";
}