| Total Complexity | 9 |
| Total Lines | 73 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | class Transition |
||
| 13 | { |
||
| 14 | /** |
||
| 15 | * @var string |
||
| 16 | */ |
||
| 17 | protected $name; |
||
| 18 | |||
| 19 | /** |
||
| 20 | * @var State[] |
||
| 21 | */ |
||
| 22 | protected $fromStates; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * @var State |
||
| 26 | */ |
||
| 27 | protected $toState; |
||
| 28 | |||
| 29 | /** |
||
| 30 | * @var null|callable |
||
| 31 | */ |
||
| 32 | protected $checker; |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Transition constructor. |
||
| 36 | * |
||
| 37 | * @param string $name |
||
| 38 | * @param array|State $from |
||
| 39 | * @param State $to |
||
| 40 | * @param callable $checker |
||
| 41 | */ |
||
| 42 | public function __construct(string $name, $from, State $to, $checker = null) |
||
| 48 | } |
||
| 49 | |||
| 50 | /** |
||
| 51 | * @return State[] |
||
| 52 | */ |
||
| 53 | public function getFromStates(): array |
||
| 56 | } |
||
| 57 | |||
| 58 | /** |
||
| 59 | * @return State |
||
| 60 | */ |
||
| 61 | public function getToState(): State |
||
| 62 | { |
||
| 63 | return $this->toState; |
||
| 64 | } |
||
| 65 | |||
| 66 | /** |
||
| 67 | * @param StatefulInterface $stateful |
||
| 68 | * @param array $parameters |
||
| 69 | * |
||
| 70 | * @return bool |
||
| 71 | */ |
||
| 72 | public function can(StatefulInterface $stateful, array $parameters = []): bool |
||
| 85 | } |
||
| 86 | } |
||
| 87 |