con = $con; } /** * Execute the workflow * * @return int * * @since 1.0.0 */ public function run($data) : int { switch ($this->state) { case States::DEFAULT: $this->state = $this->runRequest($data); break; case States::PENDING: $this->state = $this->runPending($data); break; default: } return $this->state; } /** * Run tasks during the request * * @return int * * @since 1.0.0 */ public function runRequest($data) : int { // create workflow // create task // set state 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 { // approve?! return 0; } /** * Get the state of the workflow * * @return int * * @since 1.0.0 */ public function getState() : int { return $this->state; } }