StateDiagram Class¶
- class StateDiagram¶
Represents a state diagram
- addClassDef(array $classDef)¶
Add class definition(s)
- Parameters:
$classDef (
array) – The class definition(s)
- Returns:
A new instance of StateDiagram with the class definition(s) added
- Return type:
- addState(StateInterface ...$state)¶
Adds state(s)
- Parameters:
...$state (
StateInterface) – The state(s)
- Returns:
A new instance of StateDiagram with the state(s) added
- Return type:
- addTransition(Transition ...$transition)¶
Adds transition(s)
- Parameters:
...$transition (
Transition) – The transition(s)
- Returns:
A new instance of StateDiagram with the transition(s) added
- Return type:
- render(array $attributes = [])¶
Renders the diagram
- Parameters:
$attributes (
array) –HTML attributes for the <pre> tag as name=>value pairs
Note
The mermaid class is added
- Returns:
Mermaid diagram code in a <pre> tag
- Return type:
string
- withClassDef(array $classDef)¶
Set class definition(s)
- Parameters:
$classDef (
array) – The class definition(s)
- Returns:
A new instance of StateDiagram with the class definition(s)
- Return type:
- withComment(string $comment)¶
Set a comment
- Parameters:
$comment (
string) – The comment
- Returns:
A new instance of StateDiagram with a comment
- Return type:
- withDirection(Direction $direction)¶
Set the diagram direction
- Parameters:
$direction (
Direction) – The direction
- Returns:
A new instance of StateDiagram with the direction set
- Return type:
- withState(StateInterface ...$state)¶
Set state(s)
- Parameters:
...$state (
StateInterface) – The state(s)
- Returns:
A new instance of StateDiagram with the state(s)
- Return type:
- withTransition(Transition ...$transition)¶
Sets transition(s)
- Parameters:
...$transition (
Transition) – The transition(s)
- Returns:
A new instance of StateDiagram with the transition(s)
- Return type: