cleanup and tests added for ci/cd

This commit is contained in:
Dennis Eichhorn 2019-11-20 22:28:04 +01:00
parent 5f4a4f2866
commit d42725a5f0

View File

@ -31,11 +31,25 @@ class Workflow implements WorkflowInterface
private $state = 0; private $state = 0;
private $con = null; private $con = null;
/**
* Constructor.
*
* @param ConnectionAbstract $con Database connection
*
* @since 1.0.0
*/
public function __construct(ConnectionAbstract $con) public function __construct(ConnectionAbstract $con)
{ {
$this->con = $con; $this->con = $con;
} }
/**
* Execute the workflow
*
* @return int
*
* @since 1.0.0
*/
public function run($data) : int public function run($data) : int
{ {
switch ($this->state) { switch ($this->state) {
@ -51,6 +65,13 @@ class Workflow implements WorkflowInterface
return $this->state; return $this->state;
} }
/**
* Run tasks during the request
*
* @return int
*
* @since 1.0.0
*/
public function runRequest($data) : int public function runRequest($data) : int
{ {
// todo: create workflow // todo: create workflow
@ -60,6 +81,15 @@ class Workflow implements WorkflowInterface
return 0; return 0;
} }
/**
* Run tasks after the status change from pending
*
* The next status could be a new request, an approval or dismissal
*
* @return int
*
* @since 1.0.0
*/
public function runPending($data) : int public function runPending($data) : int
{ {
// todo: approve?! // todo: approve?!
@ -68,6 +98,13 @@ class Workflow implements WorkflowInterface
return 0; return 0;
} }
/**
* Get the state of the workflow
*
* @return int
*
* @since 1.0.0
*/
public function getState() : int public function getState() : int
{ {
return $this->state; return $this->state;