public function Dbug::__construct in dBug for Drupal 2.0.x
Same name and namespace in other branches
- 8 src/Dbug.php \Drupal\dbug\Dbug::__construct()
- 1.0.x src/Dbug.php \Drupal\dbug\Dbug::__construct()
Dbug constructor.
Parameters
mixed $var: The variable to debug.
string $forceType: Variable type to be forced.
bool $bCollapsed: Collapse the result?
File
- src/
Dbug.php, line 166
Class
- Dbug
- Implementation of dBug for Drupal.
Namespace
Drupal\dbugCode
public function __construct($var, $forceType = "", $bCollapsed = FALSE) {
// Include js and css scripts.
if (!defined('BDBUGINIT')) {
define("BDBUGINIT", TRUE);
}
// Array of variable types that can be "forced".
$arrAccept = [
"array",
"object",
"xml",
];
$this->bCollapsed = $bCollapsed;
if (in_array($forceType, $arrAccept)) {
$this
->{"varIs" . ucfirst($forceType)}($var);
}
else {
$this
->checkType($var);
}
}