You are here

public function DevelDumperManager::dumpOrExport in Devel 8.3

Same name and namespace in other branches
  1. 8 src/DevelDumperManager.php \Drupal\devel\DevelDumperManager::dumpOrExport()
  2. 8.2 src/DevelDumperManager.php \Drupal\devel\DevelDumperManager::dumpOrExport()
  3. 4.x src/DevelDumperManager.php \Drupal\devel\DevelDumperManager::dumpOrExport()

Wrapper for ::dump() and ::export().

Parameters

mixed $input: The variable to dump.

string $name: (optional) The label to output before variable, defaults to NULL.

bool $export: (optional) Whether return string representation of a variable.

string $plugin_id: (optional) The plugin ID, defaults to NULL.

Return value

string|null String representation of a variable if $export is set to TRUE, NULL otherwise.

Overrides DevelDumperManagerInterface::dumpOrExport

File

src/DevelDumperManager.php, line 117

Class

DevelDumperManager
Class DevelDumperManager.

Namespace

Drupal\devel

Code

public function dumpOrExport($input, $name = NULL, $export = TRUE, $plugin_id = NULL) {
  if ($this
    ->hasAccessToDevelInformation()) {
    $dumper = $this
      ->createInstance($plugin_id);
    if ($export) {
      return $dumper
        ->export($input, $name);
    }
    $dumper
      ->dump($input, $name);
  }
  return NULL;
}