APIController
class APIController extends BaseController
This class deals with the API function of the simulation engine.
For a simulator to accept an API request, the following parameters must be defined in the "parameters.yml" file:
api: <simulator name>: step: <step number> action: <action button name>
the API conforms to the JSON API
Properties
ControllersHelper | $helper | from BaseController | |
Simulator | $simu | from BaseController | |
protected Parser | $parser | from BaseController | |
protected bool | $error | from BaseController | |
protected int | $recursion | from BaseController | |
protected array | $simuWidgets | from BaseController | |
protected array | $variables | from BaseController | |
protected array | $memo | from BaseController | |
protected mixed|null | $sources | from BaseController | |
protected array | $log | from BaseController | |
protected int | $script | from BaseController | |
protected array | $sequence | from BaseController | |
protected string | $path | from BaseController | |
array | $uricache | from BaseController | |
string | $databasesDir | from BaseController | |
string | $simulatorsDir | from BaseController | |
string | $publicDir | from BaseController | |
string | $viewsDir | from BaseController | |
private array | $datas | ||
private array | $metas | ||
private array | $errors |
Methods
Run the simulation engine for a step
Adds widgets that depend on a widget in the list of widgets
Returns the simulators attributes in JSON response format
Returns the requested source attributes in JSON response format
Get the simulators directory
Evaluates a condition with the expression parser
Evaluates the conditions of a business rule an executes the suitable actions
Evaluates the conditions of all business rules an executes the suitable actions
Composes a parameter error
Composes an entity error
Details
in BaseController at line 219
protected Response|Step|null
runStep(Request $request, array $form, string $simu, string $view, bool $test)
Run the simulation engine for a step
in BaseController at line 510
protected void
addWidget(string $widget)
Adds a widget to the list of widgets
in BaseController at line 526
protected void
widgetDeps(string $widget, array $widgets, array $availWidgets)
Adds widgets that depend on a widget in the list of widgets
in BaseController at line 547
protected Response
runFields(Request $request, string $simu, bool $test = false)
Returns the simulators attributes in JSON response format
in BaseController at line 568
protected Response
runSource(Request $request, string $simu, bool $test = false)
Returns the requested source attributes in JSON response format
in BaseController at line 614
protected string
getSimuPath(string $simu, bool $test = false)
Get the simulators directory
in BaseController at line 642
protected void
checkField(Field $field, array $form, bool $skipValidation)
Checks the given field
in BaseController at line 702
protected void
processField(Field $field, Step $step, bool $displayable)
Processes the given field for the step
in BaseController at line 752
protected void
replaceFieldNotes(Field $field)
Replaces data values in the notes of a field
in BaseController at line 772
protected string|false
evaluate(string $condition)
Evaluates a condition with the expression parser
in BaseController at line 788
protected void
evaluateDefault(Data $data)
Evaluates the default value of the given data
in BaseController at line 807
protected void
evaluateDefaults()
Evaluates the default value of all data
in BaseController at line 829
protected void
evaluateMin(Data $data)
Evaluates the minimum value of the given data
in BaseController at line 851
protected void
evaluateMax(Data $data)
Evaluates the maximum value of the given data
in BaseController at line 872
protected void
evaluateMinMax()
Evaluates the minimum and the maximum value of all data
in BaseController at line 896
protected void
processData(Data $data, int $istep)
Processes the given data for the step
in BaseController at line 995
protected void
processActions(Action $actions, int $istep)
Executes all the actions of a business rule of the step
in BaseController at line 1195
protected void
processRule(BusinessRule $businessrule, int $istep)
Evaluates the conditions of a business rule an executes the suitable actions
in BaseController at line 1214
protected void
processRules(int $istep)
Evaluates the conditions of all business rules an executes the suitable actions
in BaseController at line 1230
protected void
processDatas(int $istep)
Processes all data for the step
at line 98
Response|Step
calculAction(Request $request, Simulator $simu)
The entry point of the API request
at line 112
Response|Step
tryItAction(Request $request, Simulator $simu)
The entry point of the API request in test mode
at line 127
protected Response|Step
runCalcul(Request $request, Simulator $simu, bool $test = false)
Run the simulation engine
at line 161
protected Response
apiOutput(Request $request, array $form, Step $step)
Composes the API response
at line 290
private void
processApiField(array $form, Field $field)
Processes the API field
at line 316
private void
processApiFieldData(array $form, Data $data)
Processes the API field data
at line 333
private void
addResponseError(array $form, Data $data)
Add response error
at line 360
private void
addParameterError(string $parameter, string $title, string $detail)
Composes a parameter error
at line 382
private void
addEntityError(string $entity, string $title, string $detail)
Composes an entity error