Documentation

LocalClosure
in package
implements IClosure

Class LocalClosure

Represents a local closure handler for events.

Table of Contents

Interfaces

IClosure
Interface IClosure

Properties

$_callable  : mixed
$_object  : object|null

Methods

__construct()  : mixed
LocalClosure constructor.
AsyncInvoke()  : Process
Invokes the closure asynchronously.
Invoke()  : bool|null
Invokes the closure synchronously.
Serialize()  : string
Serializes the closure.
Unserialize()  : LocalClosure|null
Unserializes a serialized closure.

Properties

$_callable

private mixed $_callable

The callable object or function.

$_object

private object|null $_object

The object associated with the closure.

Methods

__construct()

LocalClosure constructor.

public __construct(mixed $callable[, object|null $object = null ]) : mixed
Parameters
$callable : mixed

The callable object or function.

$object : object|null = null

The object associated with the closure.

AsyncInvoke()

Invokes the closure asynchronously.

public AsyncInvoke(string|Event $event, mixed $args) : Process
Parameters
$event : string|Event

The event object or its name.

$args : mixed

Additional arguments to pass to the closure.

Return values
Process

A Process object representing the asynchronous execution.

Invoke()

Invokes the closure synchronously.

public Invoke(string|Event $event, mixed $args) : bool|null
Parameters
$event : string|Event

The event object or its name.

$args : mixed

Additional arguments to pass to the closure.

Return values
bool|null

True if the closure was successfully invoked, otherwise false. Null if invocation fails.

Serialize()

Serializes the closure.

public Serialize() : string
Return values
string

The serialized closure.

Unserialize()

Unserializes a serialized closure.

public static Unserialize(string $serialized) : LocalClosure|null
Parameters
$serialized : string

The serialized closure.

Return values
LocalClosure|null

An instance of LocalClosure, or null if unserialization fails.


        
On this page

Search results