CRM_Utils_GlobalStack
in package
Temporarily change a global variable.
$globals = CRM_Utils_GlobalStack::singleton();
$globals->push(array(
'_GET' => array(
'q' => 'some-value
),
));
...do stuff...
$globals->pop();
Note: for purposes of this class, we'll refer to the array passed into push() as a frame.
Table of Contents
Properties
- $_singleton : object
- We don't have a container or dependency-injection, so use singleton instead
- $backups : mixed
Methods
- applyFrame() : mixed
- createBackup() : array<string|int, mixed>
- pop() : mixed
- push() : mixed
- singleton() : CRM_Utils_GlobalStack
- Get or set the single instance of CRM_Utils_GlobalStack.
Properties
$_singleton
We don't have a container or dependency-injection, so use singleton instead
private
static object
$_singleton
= \NULL
$backups
private
mixed
$backups
= []
Methods
applyFrame()
public
applyFrame(mixed $newFrame) : mixed
Parameters
- $newFrame : mixed
createBackup()
public
createBackup(array<string|int, mixed> $new) : array<string|int, mixed>
Parameters
- $new : array<string|int, mixed>
-
The new, incoming frame.
Return values
array<string|int, mixed> —frame
pop()
public
pop() : mixed
push()
public
push(mixed $newFrame) : mixed
Parameters
- $newFrame : mixed
singleton()
Get or set the single instance of CRM_Utils_GlobalStack.
public
static singleton() : CRM_Utils_GlobalStack