for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace nstdio\notymo;
/**
* Class CallbackInvoker
*
* @package nstdio\notymo
* @author Edgar Asatryan <[email protected]>
*/
class CallbackInvoker implements LifeCycleCallback, LifeCycleCallbackInvoker
{
* @var callable
protected $onComplete;
protected $onEachSent;
protected $onError;
public function callOnComplete(MessageQueue $param)
if (isset($this->onComplete)) {
call_user_func_array($this->onComplete, array($param));
}
public function callOnEachSent(MessageInterface $message, $feedBack = null)
if (isset($this->onEachSent)) {
call_user_func_array($this->onEachSent, array($message, $feedBack));
* @inheritdoc
public function onComplete(callable $callback)
$this->onComplete = $callback;
public function onEachSent(callable $callback)
$this->onEachSent = $callback;
* Removes all callbacks.
* Will be called immediately after `onSent`.
public function detach()
unset($this->onComplete, $this->onEachSent, $this->onError);