libSmalldb  v0.7-66-gb94d22a
Public Member Functions | List of all members
IMachineDefinitionReader Interface Reference

Description

Interface of state machine definition reader – converts external file to Smalldb machine definition.

Inheritance diagram for IMachineDefinitionReader

Public Member Functions

 isSupported (string $file_extension)
 Return true if the file looks parsable by this reader. More...
 
 loadString (string $machine_type, string $data_string, array $options=[], string $filename=null)
 Parse string and return fragment of state machine definition. More...
 
 postprocessDefinition (string $machine_type, array & $machine_def, array & $errors)
 If reader was invoked, it may need to postprocess the definition when everything is loaded (after last loadString call is completed). More...
 

Member Function Documentation

◆ isSupported()

isSupported ( string  $file_extension)

Return true if the file looks parsable by this reader.

Parameters
string$file_extensionFile extension including leading dot (e.g. ".json")
Returns
bool

Implemented in BpmnReader, GraphMLReader, and JsonReader.

◆ loadString()

loadString ( string  $machine_type,
string  $data_string,
array  $options = [],
string  $filename = null 
)

Parse string and return fragment of state machine definition.

Parameters
string$machine_typeName of state machine (for better error messages)
string$data_stringData to parse.
array$optionsAdditional options specified in master definition.
string$filenameName of the file (or similar identifier) - only for debug messages.
Returns
array - Fragment of machine definition.

Implemented in BpmnReader, GraphMLReader, and JsonReader.

◆ postprocessDefinition()

postprocessDefinition ( string  $machine_type,
array &  $machine_def,
array &  $errors 
)

If reader was invoked, it may need to postprocess the definition when everything is loaded (after last loadString call is completed).

Postprocessing is invoked only once, even when loadString has been invoked multiple times.

Parameters
string$machine_typeName of state machine (for better error messages)
array$machine_defMachine definition to be processed in place.
array$errorsList of errors in state machine definition. Errors may be specified in the diagram as well.
Returns
bool True when machine is successfully loaded, false otherwise.

Implemented in BpmnReader, GraphMLReader, and JsonReader.