You are here

private function Snapshot::snapshotGlobals in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 vendor/sebastian/global-state/src/Snapshot.php \SebastianBergmann\GlobalState\Snapshot::snapshotGlobals()

Creates a snapshot of all global and super-global variables.

1 call to Snapshot::snapshotGlobals()
Snapshot::__construct in vendor/sebastian/global-state/src/Snapshot.php
Creates a snapshot of the current global state.

File

vendor/sebastian/global-state/src/Snapshot.php, line 337

Class

Snapshot
A snapshot of global state.

Namespace

SebastianBergmann\GlobalState

Code

private function snapshotGlobals() {
  $superGlobalArrays = $this
    ->superGlobalArrays();
  foreach ($superGlobalArrays as $superGlobalArray) {
    $this
      ->snapshotSuperGlobalArray($superGlobalArray);
  }
  foreach (array_keys($GLOBALS) as $key) {
    if ($key != 'GLOBALS' && !in_array($key, $superGlobalArrays) && $this
      ->canBeSerialized($GLOBALS[$key]) && !$this->blacklist
      ->isGlobalVariableBlacklisted($key)) {
      $this->globalVariables[$key] = unserialize(serialize($GLOBALS[$key]));
    }
  }
}