From 80cb5d17b2f6228e174edb0853b2c39c5d6dac21 Mon Sep 17 00:00:00 2001 From: Victor Westerlund Date: Fri, 19 Apr 2024 09:43:51 +0000 Subject: [PATCH] feat: add captured flag property (#2) --- src/GlobalSnapshot.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/GlobalSnapshot.php b/src/GlobalSnapshot.php index 4c2a917..a9cac1c 100644 --- a/src/GlobalSnapshot.php +++ b/src/GlobalSnapshot.php @@ -22,6 +22,8 @@ private array $argv; private ?array $__composer_autoload_files; // Native support for composer + public bool $captured = false; + public function __construct() {} // Wipe all superglobals @@ -42,6 +44,8 @@ // Store current state of superglobals public function capture() { + $this->captured = true; + foreach (array_keys($GLOBALS) as $global) { $this->{$global} = $GLOBALS[$global]; }