Once
class Once (View source)
Properties
| static protected Once|null | $instance | The current globally used instance. |
|
| static protected bool | $enabled | Indicates if the once instance is enabled. |
Methods
__construct(WeakMap $values)
Create a new once instance.
bool
usesSameObjects(array $references, array $objects)
Determine if the cached references still point to the given objects.
static void
enable()
Re-enable the once instance if it was disabled.
static void
disable()
Disable the once instance.
static void
flush()
Flush the once instance.
Details
protected
__construct(WeakMap $values)
Create a new once instance.
static Once
instance()
Create a new once instance.
mixed
value(Onceable $onceable)
Get the value of the given onceable.
protected bool
usesSameObjects(array $references, array $objects)
Determine if the cached references still point to the given objects.
Object hashes are based on object IDs, which PHP reuses once an object is destroyed.
static void
enable()
Re-enable the once instance if it was disabled.
static void
disable()
Disable the once instance.
static void
flush()
Flush the once instance.