You are here

protected function Dbug::checkType in dBug for Drupal 8

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

Check variable type.

Parameters

mixed $var: The variable.

3 calls to Dbug::checkType()
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::__construct in src/Dbug.php
Dbug constructor.

File

src/Dbug.php, line 316

Class

Dbug
Implementation of dBug for Drupal.

Namespace

Drupal\dbug

Code

protected function checkType($var) {
  switch (gettype($var)) {
    case "resource":
      $this
        ->varIsResource($var);
      break;
    case "object":
      $this
        ->varIsObject($var);
      break;
    case "array":
      $this
        ->varIsArray($var);
      break;
    case "NULL":
      $this
        ->varIsNull();
      break;
    case "boolean":
      $this
        ->varIsBoolean($var);
      break;
    default:
      $var = $var == "" ? "[empty string]" : $var;
      $this->output[] = "<table cellspacing=0><tr>\n<td>" . $var . "</td>\n</tr>\n</table>\n";
      break;
  }
}