class State implements StateInterface (View source)

A value object representing a workflow state.

Properties

protected WorkflowTypeInterface $workflow

The workflow the state is attached to.

protected string $id

The state's ID.

protected string $label

The state's label.

protected int $weight

The state's weight.

Methods

__construct(WorkflowTypeInterface $workflow, string $id, string $label, int $weight = 0)

State constructor.

string
id()

Gets the state's ID.

string
label()

Gets the state's label.

int
weight()

Gets the state's weight.

bool
canTransitionTo($to_state_id)

Determines if the state can transition to the provided state ID.

getTransitionTo($to_state_id)

No description

getTransitions()

Gets all the possible transition objects for the state.

static string
labelCallback(StateInterface $state)

Helper method to convert a State value object to a label.

Details

__construct(WorkflowTypeInterface $workflow, string $id, string $label, int $weight = 0)

State constructor.

Parameters

WorkflowTypeInterface $workflow

The workflow the state is attached to.

string $id

The state's ID.

string $label

The state's label.

int $weight

The state's weight.

string id()

Gets the state's ID.

Return Value

string

The state's ID.

string label()

Gets the state's label.

Return Value

string

The state's label.

int weight()

Gets the state's weight.

Return Value

int

The state's weight.

bool canTransitionTo($to_state_id)

Determines if the state can transition to the provided state ID.

Parameters

$to_state_id

The state to transition to.

Return Value

bool

TRUE if the state can transition to the provided state ID. FALSE, if not.

getTransitionTo($to_state_id)

No description

Parameters

$to_state_id

TransitionInterface[] getTransitions()

Gets all the possible transition objects for the state.

Return Value

TransitionInterface[]

All the possible transition objects for the state.

static string labelCallback(StateInterface $state)

Helper method to convert a State value object to a label.

Parameters

StateInterface $state

The state.

Return Value

string

The label of the state.