Skip to content

Commit

Permalink
2.23
Browse files Browse the repository at this point in the history
  • Loading branch information
jorgecc-business-account committed Sep 12, 2022
1 parent 0c931d5 commit 726eb10
Show file tree
Hide file tree
Showing 7 changed files with 184 additions and 60 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,9 @@ Commonly, the log format could be of the type info or error. Flag could show a
Dual license (LGPL 3.0 and Commercial). See LICENSE file.

## Version
* 2.23 22-09-11
* Added description (comments) to transitions.
* Fixed a problem with the GUI (job must be an integer)
* 2.22 22-09-11
* Added variables \_state0,\_state1,\_time,\_result and fixed \_idjob
* 2.21.1 2022-09-03
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
"require": {
"php": ">=7.2",
"eftec/pdoone": "^3.12.2",
"eftec/minilang": "^2.26",
"eftec/minilang": "^2.27",
"ext-ctype": "*",
"ext-json": "*",
"eftec/documentstoreone": "^1.24"
Expand Down
2 changes: 1 addition & 1 deletion lib/Flags.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @noinspection UnknownInspectionInspection */
<?php
/** @noinspection TypeUnsafeComparisonInspection */
/** @noinspection PhpUnused */

Expand Down
2 changes: 1 addition & 1 deletion lib/Job.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @noinspection UnknownInspectionInspection */
<?php
/** @noinspection PhpUnused */
/** @noinspection PhpUnusedParameterInspection */

Expand Down
2 changes: 1 addition & 1 deletion lib/Pending.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @noinspection UnknownInspectionInspection */
<?php

/** @noinspection PhpUnused */

Expand Down
220 changes: 168 additions & 52 deletions lib/StateMachineOne.php

Large diffs are not rendered by default.

13 changes: 9 additions & 4 deletions lib/Transition.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php /** @noinspection UnknownInspectionInspection */
<?php
/** @noinspection PhpUnusedParameterInspection */
/** @noinspection PhpUnused */

Expand Down Expand Up @@ -27,6 +27,8 @@ class Transition
public $conditions;
/** @var string=['change','pause','continue','stop','stay','stayonce'][$i] */
public $result = '';
/** @var string|null an optional description of the transition */
public $description;
/** @var MiniLang */
public $miniLang;
/** @var StateMachineOne */
Expand Down Expand Up @@ -61,15 +63,17 @@ class Transition
* @param string $result =['change','pause','continue','stop','stay'][$i]
* @param bool $storeClass If true, then it doesn't change the state, but it stores the operation in
* MiniLang. It is useful if you want to create a MiniLang class.
* @param string|null $description an optional description
* @see https://github.com/EFTEC/MiniLang for more information about conditions.
*/
public function __construct(StateMachineOne $caller, $state0, $state1, $conditions
, string $result = '', bool $storeClass = false)
, string $result = '', bool $storeClass = false,?string $description=null)
{
$this->caller = $caller;
$this->state0 = $state0;
$this->state1 = $state1;
$this->result = $result;
$this->description=$description;
if (is_callable($conditions)) {
$this->txtCondition = 'custom function()';
$this->function = $conditions;
Expand All @@ -80,10 +84,10 @@ public function __construct(StateMachineOne $caller, $state0, $state1, $conditio
// we need to evaluate the code (otherwise, we do nothing)
if ($storeClass) {
// we generate php code
$this->caller->miniLang->separate2($conditions); // this process could be a bit expensive.
$this->caller->miniLang->separate2($conditions,-1,$description); // this process could be a bit expensive.
} else {
// we parse the code in runtime.
$this->caller->miniLang->separate($conditions); // this process could be a bit expensive.
$this->caller->miniLang->separate($conditions,-1,$description); // this process could be a bit expensive.
}
}
if (isset($this->caller->miniLang->areaValue['timeout'])) {
Expand Down Expand Up @@ -266,6 +270,7 @@ public function setDuration(int $duration): Transition
}

/**
* It gets the conditions (set/get/init) untouched.
* @return string
*/
public function getTxtCondition(): string
Expand Down

0 comments on commit 726eb10

Please sign in to comment.