예제 #1
0
 private function restoreAllGlobals()
 {
     $superGlobalArrays = $this->globalStateSnapshot->superGlobalArrays();
     $globalVariables = $this->globalStateSnapshot->globalVariables();
     foreach (array_keys($globalVariables) as $key) {
         if ($key != 'GLOBALS' && !in_array($key, $superGlobalArrays) && !$this->globalStateSnapshot->blacklist()->isGlobalVariableBlacklisted($key)) {
             if (!isset($GLOBALS[$key])) {
                 $GLOBALS[$key] = $globalVariables[$key];
             }
         }
     }
 }
 /**
  * Restores all global and super-global variables from a snapshot.
  *
  * @param Snapshot $snapshot
  */
 public function restoreGlobalVariables(Snapshot $snapshot)
 {
     $superGlobalArrays = $snapshot->superGlobalArrays();
     foreach ($superGlobalArrays as $superGlobalArray) {
         $this->restoreSuperGlobalArray($snapshot, $superGlobalArray);
     }
     $globalVariables = $snapshot->globalVariables();
     foreach (array_keys($GLOBALS) as $key) {
         if ($key != 'GLOBALS' && !in_array($key, $superGlobalArrays) && !$snapshot->blacklist()->isGlobalVariableBlacklisted($key)) {
             if (isset($globalVariables[$key])) {
                 $GLOBALS[$key] = $globalVariables[$key];
             } else {
                 unset($GLOBALS[$key]);
             }
         }
     }
 }