Property | Type | Description | |
---|---|---|---|
$callable_entry | callable | the entry callable method | |
$callable_exit | callable | the exit callable method | |
$command_entry_name | string | This can actually be a ',' seperated string of multiple commands that will be executed as a composite. | |
$command_exit_name | string | This can actually be a ',' seperated string of multiple commands that will be executed as a composite. | |
$description | string | a description for the state | |
$name | string | The name of the state | |
$transitions | These will be set by Transition objects (they provide the association) this is not a hashmap, so the order of Transitions *might* be important. whenever a State is asked for it's transitions, the first transition might be tried first. this might have performance and configuration benefits | ||
$type | string | The state type: - State::TYPE_INITIAL - State::TYPE_NORMAL - State::TYPE_FINAL - State::TYPE_REGEX |
Method | Description | |
---|---|---|
__construct ( string $name, string $type = self::TYPE_NORMAL, $command_entry_name = self::COMMAND_EMPTY, $command_exit_name = self::COMMAND_EMPTY, callable $callable_entry = self::CALLABLE_NULL, callable $callable_exit = self::CALLABLE_NULL ) | ||
__toString ( ) : string | ||
addTransition ( |
add an outgoing transition from this state. | |
entryAction ( |
An action executed every time a state is entered. | |
exitAction ( |
An action executed every time a state is exited. | |
getDescription ( ) : string | get the description for this state (if any) | |
getEntryCallable ( ) : callable | get the entry callable, the callable to be called when entering this state | |
getEntryCommandName ( ) : string | get the fully qualified command name for entry of the state | |
getExitCallable ( ) : callable | get the exit callable, the callable to be called when exiting this state | |
getExitCommandName ( ) : string | get the fully qualified command name for exit of the state | |
getName ( ) | gets the name of this state | |
getTransitions ( ) : |
get all outgoing transitions | |
getTransitionsTriggeredByEvent ( string $event ) : |
get the transition for this state that can be triggered by an event code. | |
getType ( ) : string | get the state type | |
hasTransition ( string $transition_name ) : boolean | Do we have a transition from this state with a certain name? | |
isFinal ( ) : boolean | is it a final state | |
isInitial ( ) : boolean | is it an initial state | |
isNegatedRegex ( ) : boolean |
is this state a negated regex type of state?
"not-regex: |
|
isNormal ( ) : boolean | is it a normal state | |
isNormalRegex ( ) : boolean |
is this state a normal regex type of state?
"regex: |
|
isRegex ( ) : boolean |
is this state a regex type of state?
formats:
"regex: |
|
setDescription ( string $description ) | set the description of the state (for uml generation for example) | |
setEntryCallable ( callable $callable ) | set the entry callable, the callable to be called when entering this state | |
setEntryCommandName ( string $name ) | set the entry command name | |
setExitCallable ( callable $callable ) | set the exit callable, the callable to be called when exiting this state | |
setExitCommandName ( string $name ) | set the exit command name |
Method | Description | |
---|---|---|
callCallable ( callable $callable, |
calls a $callable if it exists, with the arguments $context->getEntity() | |
execute ( izzum\command\ICommand $command ) | helper method | |
getCommand ( string $command_name, |
returns the associated Command for the entry/exit action. | |
setName ( string $name ) | sets the name of this state | |
setType ( string $type ) | set the state type |
public __construct ( string $name, string $type = self::TYPE_NORMAL, $command_entry_name = self::COMMAND_EMPTY, $command_exit_name = self::COMMAND_EMPTY, callable $callable_entry = self::CALLABLE_NULL, callable $callable_exit = self::CALLABLE_NULL ) | ||
$name | string | the name of the state (can also be a regex in format: [not-]regex:/ |
$type | string | the type of the state (on of self::TYPE_<*>) |
$command_entry_name | optional: a command to be executed when a transition enters this state One or more fully qualified command (sub)class name(s) to execute when entering this state. This can actually be a ',' seperated string of multiple commands that will be executed as a composite. | |
$command_exit_name | optional: a command to be executed when a transition leaves this state One or more fully qualified command (sub)class name(s) to execute when exiting this state. This can actually be a ',' seperated string of multiple commands that will be executed as a composite. | |
$callable_entry | callable | optional: a php callable to call. eg: "function(){echo 'closure called';};" |
$callable_exit | callable | optional: a php callable to call. eg: "izzum\MyClass::myStaticMethod" |
public addTransition ( |
||
$transition | ||
return | boolan | yes in case the transition was not on the State already or in case of an invalid transition |
protected callCallable ( callable $callable, |
||
$callable | callable | |
$context | ||
$type | string | the type of callable (self::CALLABLE_ENTRY | self::CALLABLE_EXIT) |
public entryAction ( |
||
$context |
protected execute ( izzum\command\ICommand $command ) | ||
$command | izzum\command\ICommand |
public exitAction ( |
||
$context |
protected getCommand ( string $command_name, |
||
$command_name | string | entry or exit command name |
$context | ||
return | izzum\command\ICommand |
public getDescription ( ) : string | ||
return | string |
public getEntryCallable ( ) : callable | ||
return | callable |
public getEntryCommandName ( ) : string | ||
return | string |
public getExitCallable ( ) : callable | ||
return | callable |
public getExitCommandName ( ) : string | ||
return | string |
public getTransitions ( ) : |
||
return | an array of transitions |
public getTransitionsTriggeredByEvent ( string $event ) : |
||
$event | string | the event code that can trigger a transition (mealy machine) |
return |
public hasTransition ( string $transition_name ) : boolean | ||
$transition_name | string | |
return | boolean |
public isNegatedRegex ( ) : boolean | ||
return | boolean |
public isNormalRegex ( ) : boolean | ||
return | boolean |
public setDescription ( string $description ) | ||
$description | string |
public setEntryCallable ( callable $callable ) | ||
$callable | callable |
public setEntryCommandName ( string $name ) | ||
$name | string | a fully qualified command name |
public setExitCallable ( callable $callable ) | ||
$callable | callable |
public setExitCommandName ( string $name ) | ||
$name | string | a fully qualified command name |
protected callable $callable_entry | ||
return | callable |
protected callable $callable_exit | ||
return | callable |
protected string $command_entry_name | ||
return | string |
protected string $command_exit_name | ||
return | string |
protected string $description | ||
return | string |
protected Transition[],izzum\statemachine $transitions | ||
return |
protected string $type | ||
return | string |