class AsyncLogger implements CommandInterface, EventReceiverInterface, QueueReceiverInterface

Traits

Methods

handle()

Receive the event and do something with it.

$this
forRepo($repo)

Apply repository criterion to the setter, in vendor-name/project-name format

$this
from($branch)

Apply from branch criterion to the setter

boolean|string
getEventType()

Return the event type for which this receiver listens

$this
initiatedBy($username)

Apply username criterion to the setter, formatted as the formal name, e.g. 'Keith Freeman'

receive(array $event, string $eventType = null)

Called by the Event Emitter and will determine if the Event matches the set criteria

$this
on($eventType)

Apply eventType criterion to the setter

$this
to($branch)

Apply to branch criterion to the setter

$this
setQueue(QueueManager $queue)

Set the storage instance

static boolean
run($payload)

Run a command received off the queue

__construct($logFilePath)

AsyncLogger constructor.

Details

at line line 55
handle()

Receive the event and do something with it.

Here we simply queue up the event as a JSON string for logging asynchronously.

in EventReceiverFluentSetter at line line 38
$this forRepo($repo)

Apply repository criterion to the setter, in vendor-name/project-name format

Parameters

$repo

Return Value

$this

in EventReceiverFluentSetter at line line 52
$this from($branch)

Apply from branch criterion to the setter

Parameters

$branch

Return Value

$this

in EventReceiverFluentSetter at line line 64
boolean|string getEventType()

Return the event type for which this receiver listens

Return Value

boolean|string

in EventReceiverFluentSetter at line line 77
$this initiatedBy($username)

Apply username criterion to the setter, formatted as the formal name, e.g. 'Keith Freeman'

Parameters

$username

Return Value

$this

in EventReceiverFluentSetter at line line 93
receive(array $event, string $eventType = null)

Called by the Event Emitter and will determine if the Event matches the set criteria

The $eventType will only be populated if this receiver listens to all events. This is done by implementing the interface method getEventType() with a function that returns false.

Parameters

array $event
string $eventType

in EventReceiverFluentSetter at line line 115
$this on($eventType)

Apply eventType criterion to the setter

Parameters

$eventType

Return Value

$this

in EventReceiverFluentSetter at line line 129
$this to($branch)

Apply to branch criterion to the setter

Parameters

$branch

Return Value

$this

in QueueAccess at line line 18
$this setQueue(QueueManager $queue)

Set the storage instance

Parameters

QueueManager $queue

Return Value

$this

at line line 23
static boolean run($payload)

Run a command received off the queue

In other words, log the webhook, which in this case is the $payload.

Parameters

$payload

Return Value

boolean

at line line 39
__construct($logFilePath)

AsyncLogger constructor.

Parameters

$logFilePath

Exceptions

Exception