yvoyer /
php-state
| 1 | <?php declare(strict_types=1); |
||
|
0 ignored issues
–
show
Coding Style
introduced
by
Loading history...
|
|||
| 2 | |||
| 3 | namespace Star\Component\State\Transitions; |
||
| 4 | |||
| 5 | use Star\Component\State\RegistryBuilder; |
||
| 6 | use Star\Component\State\StateTransition; |
||
| 7 | |||
| 8 | final class OneToOneTransition implements StateTransition |
||
|
0 ignored issues
–
show
|
|||
| 9 | { |
||
|
0 ignored issues
–
show
|
|||
| 10 | /** |
||
|
0 ignored issues
–
show
|
|||
| 11 | * @var string |
||
| 12 | */ |
||
| 13 | private $name; |
||
|
0 ignored issues
–
show
|
|||
| 14 | |||
| 15 | /** |
||
|
0 ignored issues
–
show
|
|||
| 16 | * @var string |
||
| 17 | */ |
||
| 18 | private $from; |
||
|
0 ignored issues
–
show
|
|||
| 19 | |||
| 20 | /** |
||
|
0 ignored issues
–
show
|
|||
| 21 | * @var string |
||
| 22 | */ |
||
| 23 | private $to; |
||
|
0 ignored issues
–
show
|
|||
| 24 | |||
| 25 | 48 | public function __construct(string $name, string $from, string $to) |
|
|
0 ignored issues
–
show
|
|||
| 26 | { |
||
|
0 ignored issues
–
show
|
|||
| 27 | 48 | $this->name = $name; |
|
| 28 | 48 | $this->from = $from; |
|
| 29 | 48 | $this->to = $to; |
|
|
0 ignored issues
–
show
Equals sign not aligned with surrounding assignments; expected 3 spaces but found 1 space
This check looks for multiple assignments in successive lines of code. It will report an issue if the operators are not in a straight line. To visualize $a = "a";
$ab = "ab";
$abc = "abc";
will produce issues in the first and second line, while this second example $a = "a";
$ab = "ab";
$abc = "abc";
will produce no issues. Loading history...
|
|||
| 30 | 48 | } |
|
|
0 ignored issues
–
show
|
|||
| 31 | |||
| 32 | 47 | public function getName(): string |
|
|
0 ignored issues
–
show
|
|||
| 33 | { |
||
|
0 ignored issues
–
show
|
|||
| 34 | 47 | return $this->name; |
|
| 35 | } |
||
|
0 ignored issues
–
show
|
|||
| 36 | |||
| 37 | 47 | public function onRegister(RegistryBuilder $registry): void |
|
|
0 ignored issues
–
show
|
|||
| 38 | { |
||
|
0 ignored issues
–
show
|
|||
| 39 | 47 | $registry->registerStartingState($this->name, $this->from, []); |
|
|
0 ignored issues
–
show
|
|||
| 40 | 47 | $registry->registerDestinationState($this->name, $this->to, []); |
|
|
0 ignored issues
–
show
|
|||
| 41 | 47 | } |
|
|
0 ignored issues
–
show
|
|||
| 42 | |||
| 43 | public function getDestinationState(): string |
||
|
0 ignored issues
–
show
|
|||
| 44 | { |
||
|
0 ignored issues
–
show
|
|||
| 45 | return $this->to; |
||
| 46 | } |
||
|
0 ignored issues
–
show
|
|||
| 47 | } |
||
|
0 ignored issues
–
show
|
|||
| 48 |