You are here

vardumper.module in VarDumper 8

Same filename and directory in other branches
  1. 7 vardumper.module

Main module file for the vardumper module.

File

vardumper.module
View source
<?php

/**
 * @file
 * Main module file for the vardumper module.
 */

/**
 * API function vardumper().
 *
 * @param mixed $var
 * @param string $name
 * @param string $type
 */
function vardumper($var, $name = '', $type = 'message') {
  $service = 'vardumper_' . mb_strtolower($type);
  if (\Drupal::hasService($service)) {
    \Drupal::service($service)
      ->dump($var, $name);
  }
  else {
    \Drupal::service('vardumper_message')
      ->dump($var, $name);
  }
}

/**
 * API aliases.
 */
function vdp($var, $name = '', $type = 'message') {
  vardumper($var, $name, $type);
}

/**
 * API aliases.
 */
function vardumperMessage($var, $name = '') {
  vardumper($var, $name, 'message');
}

/**
 * API aliases.
 */
function vdpm($var, $name = '') {
  vardumper($var, $name, 'message');
}
if (!\function_exists('dump')) {

  /**
   * Dump a variable.
   */
  function dump($var, $name) {
    vardumper($var, $name, 'message');
  }
}

Functions

Namesort descending Description
vardumper API function vardumper().
vardumperMessage API aliases.
vdp API aliases.
vdpm API aliases.