Skip to content

Commit

Permalink
Add success callback support
Browse files Browse the repository at this point in the history
  • Loading branch information
simonhamp authored Feb 26, 2021
1 parent cf84de3 commit ce80dfb
Showing 1 changed file with 28 additions and 0 deletions.
28 changes: 28 additions & 0 deletions src/TaskContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,13 @@ class TaskContainer
* @var array
*/
protected $tasks = [];

/**
* All of the "success" callbacks.
*
* @var array
*/
protected $success = [];

/**
* All of the "error" callbacks.
Expand Down Expand Up @@ -480,6 +487,27 @@ public function getFinishedCallbacks()
{
return $this->finished;
}

/**
* Register an success-task callback.
*
* @param \Closure $callback
* @return void
*/
public function success(Closure $callback)
{
$this->success[] = $callback;
}

/**
* Get all of the success-task callbacks.
*
* @return array
*/
public function getSuccessCallbacks()
{
return $this->success;
}

/**
* Register an error-task callback.
Expand Down

0 comments on commit ce80dfb

Please sign in to comment.