Pantheon\Terminus\Models\Workflow::getMessage PHP Method

getMessage() public method

Get the success message of a workflow or throw an exception of the workflow failed.
public getMessage ( ) : string
return string The message to output to the user
    public function getMessage()
    {
        if (!$this->isSuccessful()) {
            $message = 'Workflow failed.';
            $final_task = $this->get('final_task');
            if (!empty($final_task) && !empty($final_task->reason)) {
                $message = $final_task->reason;
            } elseif (!empty($final_task) && !empty($final_task->messages)) {
                foreach ($final_task->messages as $data => $message) {
                    if (!is_string($message->message)) {
                        $message = print_r($message->message, true);
                    } else {
                        $message = $message->message;
                    }
                }
            }
        } else {
            $message = $this->get('active_description');
        }
        return $message;
    }