| 1 | <?php |
||
| 10 | trait CreatesFromPattern |
||
| 11 | { |
||
| 12 | /** |
||
| 13 | * The regex pattern to use for creating Transitions |
||
| 14 | * |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | private static $pattern = "/^(?P<current_state>[^+]+) \+ (?P<input>[^=]+) = (?P<next_state>.+)$/"; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * {@inheritdoc} |
||
| 21 | * |
||
| 22 | * @throws TransitionPatternMismatch |
||
| 23 | */ |
||
| 24 | 16 | public static function new(string $transition) : Transition |
|
| 39 | |||
| 40 | /** |
||
| 41 | * {@inheritdoc} |
||
| 42 | */ |
||
| 43 | 17 | public static function getPattern() : string |
|
| 47 | |||
| 48 | /** |
||
| 49 | * {@inheritdoc} |
||
| 50 | * |
||
| 51 | * @throws InvalidPattern |
||
| 52 | */ |
||
| 53 | 2 | public static function usePattern(string $pattern) |
|
| 61 | } |
||
| 62 |