Skip to content

Commit 561eee1

Browse files
2.23.1
1 parent 726eb10 commit 561eee1

4 files changed

Lines changed: 138 additions & 131 deletions

File tree

README.md

Lines changed: 43 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,48 +7,12 @@ Since this library is PHP native, then it could run in Laravel, Symfony and any
77

88
[![Packagist](https://img.shields.io/packagist/v/eftec/statemachineone.svg)](https://packagist.org/packages/eftec/statemachineone)
99
[![Total Downloads](https://poser.pugx.org/eftec/statemachineone/downloads)](https://packagist.org/packages/eftec/statemachineone)
10-
[![Maintenance](https://img.shields.io/maintenance/yes/2022.svg)]()
10+
[![Maintenance](https://img.shields.io/maintenance/yes/2023.svg)]()
1111
[![composer](https://img.shields.io/badge/composer-%3E1.8-blue.svg)]()
1212
[![php](https://img.shields.io/badge/php-7.2-green.svg)]()
1313
[![php](https://img.shields.io/badge/php-8.x-green.svg)]()
1414
[![CocoaPods](https://img.shields.io/badge/docs-70%25-yellow.svg)]()
1515

16-
- [StateMachineOne](#statemachineone)
17-
- [What is a state machine?.](#what-is-a-state-machine)
18-
- [Notes](#notes)
19-
- [Example, ChopSuey Chinese Delivery Food.](#example-chopsuey-chinese-delivery-food)
20-
- [Fields (ChopSuey's exercise)](#fields-chopsueys-exercise)
21-
- [States (ChopSuey's exercise)](#states-chopsueys-exercise)
22-
- [Transitions (ChopSuey's exercise)](#transitions-chopsueys-exercise)
23-
- [Final Code (ChopSuey's example)](#final-code-chopsueys-example)
24-
- [Other examples](#other-examples)
25-
- [Transition language](#transition-language)
26-
- [The transition language is written with the next syntax.](#the-transition-language-is-written-with-the-next-syntax)
27-
- [Transition when](#transition-when)
28-
- [Transition set](#transition-set)
29-
- [Transition else](#transition-else)
30-
- [Transition timeout (in seconds)](#transition-timeout-in-seconds)
31-
- [Transition fulltimeout (in seconds)](#transition-fulltimeout-in-seconds)
32-
- [JOB](#job)
33-
- [What is a job?](#what-is-a-job)
34-
- [Creating a job](#creating-a-job)
35-
- [Running the state machine in a job](#running-the-state-machine-in-a-job)
36-
- [Getting a job](#getting-a-job)
37-
- [Database and jobs.](#database-and-jobs)
38-
- [Fields used in Job](#fields-used-in-job)
39-
- [GUI](#gui)
40-
- [Classes](#classes)
41-
- [Cache Configuration](#cache-configuration)
42-
- [Saving configuration](#saving-configuration)
43-
- [Loading configuration:](#loading-configuration)
44-
- [Log Format](#log-format)
45-
- [[info]](#info)
46-
- [[error]](#error)
47-
- [License](#license)
48-
- [Version](#version)
49-
- [What is missing](#what-is-missing)
50-
51-
5216
## What is a state machine?.
5317

5418
A State Machine (also called **Automata**) is a procedural execution of a **job** based in **states**.
@@ -58,6 +22,46 @@ and the job changes of state (**transition**) according to some logic or conditi
5822

5923
The target of this library is to ease the process to create a state machine for business.
6024

25+
## Table of Contents
26+
27+
<!-- TOC -->
28+
* [StateMachineOne](#statemachineone)
29+
* [What is a state machine?.](#what-is-a-state-machine)
30+
* [Table of Contents](#table-of-contents)
31+
* [Notes](#notes)
32+
* [Example, ChopSuey Chinese Delivery Food.](#example-chopsuey-chinese-delivery-food)
33+
* [Fields (ChopSuey's exercise)](#fields--chopsueys-exercise-)
34+
* [States (ChopSuey's exercise)](#states--chopsueys-exercise-)
35+
* [Transitions (ChopSuey's exercise)](#transitions--chopsueys-exercise-)
36+
* [Final Code (ChopSuey's example)](#final-code--chopsueys-example-)
37+
* [Other examples](#other-examples)
38+
* [Transition language](#transition-language)
39+
* [The transition language is written with the next syntax.](#the-transition-language-is-written-with-the-next-syntax)
40+
* [Transition when](#transition-when)
41+
* [For example](#for-example)
42+
* [Transition set](#transition-set)
43+
* [Transition else](#transition-else)
44+
* [Transition timeout (in seconds)](#transition-timeout--in-seconds-)
45+
* [Transition fulltimeout (in seconds)](#transition-fulltimeout--in-seconds-)
46+
* [JOB](#job)
47+
* [What is a job?](#what-is-a-job)
48+
* [Creating a job](#creating-a-job)
49+
* [Running the state machine in a job](#running-the-state-machine-in-a-job)
50+
* [Getting a job](#getting-a-job)
51+
* [Database and jobs.](#database-and-jobs)
52+
* [Fields used in Job](#fields-used-in-job)
53+
* [GUI](#gui)
54+
* [Classes](#classes)
55+
* [Cache Configuration](#cache-configuration)
56+
* [Saving configuration](#saving-configuration)
57+
* [Loading configuration:](#loading-configuration-)
58+
* [Log Format](#log-format)
59+
* [[info]](#info)
60+
* [[error]](#error)
61+
* [License](#license)
62+
* [Version](#version)
63+
* [What is missing](#what-is-missing)
64+
<!-- TOC -->
6165

6266

6367
## Notes
@@ -651,6 +655,8 @@ Commonly, the log format could be of the type info or error. Flag could show a
651655
Dual license (LGPL 3.0 and Commercial). See LICENSE file.
652656

653657
## Version
658+
* 2.23.1 23-03-11
659+
* updated dependencies.
654660
* 2.23 22-09-11
655661
* Added description (comments) to transitions.
656662
* Fixed a problem with the GUI (job must be an integer)

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@
2020
"license": "LGPL-3.0",
2121
"require": {
2222
"php": ">=7.2",
23-
"eftec/pdoone": "^3.12.2",
23+
"eftec/pdoone": "^3.12.2||^4.0",
2424
"eftec/minilang": "^2.27",
2525
"ext-ctype": "*",
2626
"ext-json": "*",
2727
"eftec/documentstoreone": "^1.24"
2828
},
2929
"require-dev": {
30-
"phpunit/phpunit": ">5.7"
30+
"phpunit/phpunit": "^9.0"
3131
},
3232
"autoload": {
3333
"psr-4": {

lib/StateMachineOne.php

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
*
2424
* @package eftec\statemachineone
2525
* @author Jorge Patricio Castro Castillo <jcastro arroba eftec dot cl>
26-
* @version 2.23 2022-09-11
26+
* @version 2.23.1 2023-03-11
2727
* @license LGPL-3.0 (you could use in a comercial-close-source product but any change to this library must be shared)
2828
* @link https://github.com/EFTEC/StateMachineOne
2929
*/
@@ -187,14 +187,14 @@ public function __construct(?object $serviceObject, $miniLangClass = MiniLang::c
187187
* condition(s) also sets milk as 1</p>
188188
* <p><b>"when wait timeout 500"</b> = transitions if has passed more than
189189
* 500 seconds since the last stage</p>
190-
* <p><b>"when true()"</b> = it always transitions. It is the same than
190+
* <p><b>"when true()"</b> = it always transitions. It is the same as
191191
* "when
192192
* 1=1"
193193
* </p>
194194
* @param string $result =['change','pause','continue','stop','stay'][$i]
195195
* @param string|null $description
196196
* @return int Returns the last id of the transaction.
197-
* @see \eftec\statemachineone\StateMachineOne::setStates
197+
* @see StateMachineOne::setStates
198198
* @noinspection DuplicatedCode
199199
*/
200200
public function addTransition($state0, $state1, $conditions, string $result = 'change', ?string $description = null): int
@@ -234,7 +234,7 @@ public function addTransition($state0, $state1, $conditions, string $result = 'c
234234
* @param string $result =['change','pause','continue','stop','stay'][$i]
235235
* @param string|null $description An optional description
236236
* @return int Returns the last id of the transaction.
237-
* @see \eftec\statemachineone\StateMachineOne::setStates
237+
* @see StateMachineOne::setStates
238238
* @noinspection DuplicatedCode
239239
*/
240240
public function addMethodTransition2($state0, $state1, $conditions, string $result = 'change',
@@ -262,7 +262,7 @@ public function addMethodTransition2($state0, $state1, $conditions, string $resu
262262
* @param string $then if then when/where condition is empty then it always true.
263263
* @param string|null $description
264264
* @return int Returns the last id of the transaction.
265-
* @see \eftec\statemachineone\StateMachineOne::setStates
265+
* @see StateMachineOne::setStates
266266
* @noinspection DuplicatedCode
267267
*/
268268
public function duringState($state, string $then, ?string $description = null): int
@@ -293,7 +293,7 @@ public function duringState($state, string $then, ?string $description = null):
293293
* @param string $then if then when/where condition is empty then it always true.
294294
* @param string|null $description
295295
* @return int Returns the last id of the transaction.
296-
* @see \eftec\statemachineone\StateMachineOne::setStates
296+
* @see StateMachineOne::setStates
297297
* @noinspection DuplicatedCode
298298
*/
299299
public function duringState2($state, string $then, ?string $description = null): int
@@ -396,7 +396,7 @@ public function getPdoOne(): PdoOne
396396
*
397397
* @param PdoOne $pdoOne
398398
*
399-
* @see \eftec\statemachineone\StateMachineOne::setDB
399+
* @see StateMachineOne::setDB
400400
*/
401401
public function setPdoOne(PdoOne $pdoOne): void
402402
{
@@ -465,7 +465,7 @@ public function setDocDB(
465465
* @param string $schema database(schema), example "sakila"
466466
*
467467
* @return bool true if the database is open
468-
* @see \eftec\statemachineone\StateMachineOne::setPdoOne
468+
* @see StateMachineOne::setPdoOne
469469
*
470470
*/
471471
public function setDB(string $type, string $server, string $user, string $pwd, string $schema): ?bool
@@ -858,7 +858,7 @@ public function jobToArray(Job $job, bool $serializeCustom = true): array
858858
$arr[$k] = $job->fields[$k];
859859
}
860860
} elseif ($v instanceof StateSerializable) {
861-
/** @see \eftec\statemachineone\Flags::__serialize */
861+
/** @see Flags::__serialize */
862862
$text[$k] = $job->fields[$k]; //->toString();
863863
}
864864
}
@@ -956,7 +956,7 @@ private function dateToString($time = null): string
956956
* @param array $arr
957957
*
958958
* @return bool|null
959-
* @see \eftec\statemachineone\StateMachineOne::$customSaveDBJobLog
959+
* @see StateMachineOne
960960
*/
961961
public function saveDBJobLog(Job $job, array $arr): ?bool
962962
{
@@ -1383,7 +1383,7 @@ public function getJob(int $idJob): ?Job
13831383
* @param Job|null $job
13841384
*
13851385
* @throws Exception
1386-
* @see \eftec\statemachineone\StateMachineOne::addEvent
1386+
* @see StateMachineOne::addEvent
13871387
*/
13881388
public function callEvent($name, ?Job $job = null): void
13891389
{
@@ -1798,7 +1798,7 @@ public function viewUI(?Job $job = null, string $msg = ''): void
17981798
. htmlentities($job->fields[$colFields]->toString()) . "' />";
17991799
$level = $job->fields[$colFields]->getMinLevel();
18001800
$css = ($level == 0) ? 'alert-primary' : (($level == 1) ? 'alert-warning' : 'alert-danger');
1801-
/** @see \eftec\statemachineone\Flags::getStack() */
1801+
/** @see Flags::getStack */
18021802
$stack = $job->fields[$colFields]->getStack();
18031803
echo "<div class='alert $css'>";
18041804
foreach ($stack as $item) {
@@ -1979,7 +1979,7 @@ private function viewUIField($type, $colFields, $value): void
19791979
break;
19801980
case 'NUMERIC':
19811981
echo "<input class='form-control' autocomplete='off'
1982-
type='numeric' name='frm_$colFields'
1982+
type='number' name='frm_$colFields'
19831983
value='" . htmlentities($value) . "' /></br>";
19841984
break;
19851985
default:

0 commit comments

Comments
 (0)