You are here

protected function AcquiaPurgeExecutorBase::exportDebugSymbols in Acquia Purge 7

Turn a PHP variable into a string with data type information for debugging.

Parameters

mixed $data: Arbitrary PHP variable, assumed to be an associative array.

Return value

string A one line representation of the data.

1 call to AcquiaPurgeExecutorBase::exportDebugSymbols()
AcquiaPurgeExecutorBase::requestsExecute in lib/executor/AcquiaPurgeExecutorBase.php
Execute a series of HTTP requests efficiently through cURL's multi handler.

File

lib/executor/AcquiaPurgeExecutorBase.php, line 69
Contains AcquiaPurgeExecutorBase.

Class

AcquiaPurgeExecutorBase
Provides an executor, which is responsible for taking a set of invalidation objects and wiping these paths/URLs from an external cache.

Code

protected function exportDebugSymbols($data) {
  if (is_array($data)) {
    $i = array();
    foreach ($data as $k => $v) {
      $i[] = (is_string($k) ? "{$k}: " : '') . $this
        ->exportDebugSymbols($v);
    }
    return '[' . implode(', ', $i) . ']';
  }
  elseif (is_null($data)) {
    return 'NULL';
  }
  elseif (is_int($data)) {
    return "{$data}";
  }
  elseif (is_float($data)) {
    return $data . 'f';
  }
  elseif (is_bool($data)) {
    return $data ? 'TRUE' : 'FALSE';
  }
  elseif (is_string($data)) {
    return "'" . $data . "'";
  }
  else {
    return '?';
  }
}