raoul2000\workflow\base\SimpleWorkflowBehavior::ensureStatusInstance PHP Method

ensureStatusInstance() private method

If $mixed is a Status instance, it is returned without change, otherwise $mixed is considered as a status id that is used to retrieve the corresponding status instance.
private ensureStatusInstance ( mixed $mixed, boolean $strict = false ) : Status
$mixed mixed status id or status instance
$strict boolean when TRUE and exception is thrown if no status instance can be returned.
return Status the status instance or NULL if no Status instance could be found
    private function ensureStatusInstance($mixed, $strict = false)
    {
        if (empty($mixed)) {
            if ($strict) {
                throw new WorkflowException('Invalid argument : null');
            } else {
                return null;
            }
        } elseif ($mixed instanceof StatusInterface) {
            return $mixed;
        } else {
            $status = $this->_wfSource->getStatus($mixed, $this->selectDefaultWorkflowId());
            if ($status === null && $strict) {
                throw new WorkflowException('Status not found : ' . $mixed);
            }
            return $status;
        }
    }