You are here

public static function Message::stringifyValues in Hook Update Deploy Tools 8

Same name and namespace in other branches
  1. 7 src/Message.php \HookUpdateDeployTools\Message::stringifyValues()

Loops through an array and pretty prints any values that are arrays or obj.

Parameters

array $variables: A variables array ready for logger, but possibly containing arrays or objects as first level array values..

Return value

array A single level array where all values are pretty printed.

1 call to Message::stringifyValues()
Message::make in src/Message.php
Logs a system message and outputs it to drush terminal if run from drush.

File

src/Message.php, line 139

Class

Message

Namespace

HookUpdateDeployTools

Code

public static function stringifyValues($variables) {
  if (is_array($variables) || is_object($variables)) {
    foreach ($variables as $key => $value) {
      $variables[$key] = is_array($value) || is_object($value) ? '<pre>' . print_r($value, TRUE) . '</pre>' : $value;
    }
  }
  return $variables;
}