Closure
Less than 1 minute
Closure
The Hazaar Closure Class.
This class is a wrapper around PHP's Closure class that allows for the serialization of closures. This is useful for storing closures in a database or transmitting them over a network.
- Full name:
\Hazaar\Closure
- This class implements:
\JsonSerializable
Properties
closure
protected \Closure|\stdClass $closure
reflection
protected \ReflectionFunction $reflection
code
private string $code
Methods
__construct
public __construct(\Closure|\stdClass $function = null): mixed
Parameters:
Parameter | Type | Description |
---|---|---|
$function | \Closure|\stdClass |
__invoke
public __invoke(): mixed
__toString
public __toString(): string
__sleep
public __sleep(): string[]
__wakeup
public __wakeup(): void
getClosure
public getClosure(): \Closure
getCode
public getCode(): string
loadCodeFromString
public loadCodeFromString(string $string): void
Parameters:
Parameter | Type | Description |
---|---|---|
$string | string |
getParameters
public getParameters(): \ReflectionParameter[]
jsonSerialize
public jsonSerialize(): array
fetchCode
protected fetchCode(): string
Automatically generated on 2024-11-14