mirror of
https://codeberg.org/vlw/php-globalsnapshot.git
synced 2025-09-13 20:03:41 +02:00
feat: add captured flag property (#2)
This commit is contained in:
parent
a5e39a44e9
commit
80cb5d17b2
1 changed files with 4 additions and 0 deletions
|
@ -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];
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue