mirror of
https://github.com/Karaka-Management/oms-Workflow.git
synced 2026-02-14 12:58:40 +00:00
cleanup and tests added for ci/cd
This commit is contained in:
parent
5f4a4f2866
commit
d42725a5f0
|
|
@ -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;
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user