EventBehavior   A
last analyzed

Complexity

Total Complexity 6

Size/Duplication

Total Lines 40
Duplicated Lines 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 6
eloc 16
dl 0
loc 40
ccs 17
cts 17
cp 1
rs 10
c 0
b 0
f 0

6 Methods

Rating   Name   Duplication   Size   Complexity  
A fromState() 0 3 1
A toState() 0 3 1
A object() 0 3 1
A graph() 0 3 1
A __construct() 0 7 1
A transition() 0 3 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Dflydev\FiniteStateMachine\Event;
6
7
use Dflydev\FiniteStateMachine\Graph\Graph;
8
use Dflydev\FiniteStateMachine\State\State;
9
use Dflydev\FiniteStateMachine\Transition\Transition;
10
11
trait EventBehavior
12
{
13
    private Graph $graph;
14
    private object $object;
15
    private Transition $transition;
16
    private State $fromState;
17
    private State $toState;
18
19 7
    public function __construct(Graph $graph, object $object, Transition $transition, State $fromState, State $toState)
20
    {
21 7
        $this->graph = $graph;
22 7
        $this->object = $object;
23 7
        $this->transition = $transition;
24 7
        $this->fromState = $fromState;
25 7
        $this->toState = $toState;
26 7
    }
27
28 1
    public function graph(): Graph
29
    {
30 1
        return $this->graph;
31
    }
32
33 7
    public function object(): object
34
    {
35 7
        return $this->object;
36
    }
37
38 7
    public function transition(): Transition
39
    {
40 7
        return $this->transition;
41
    }
42
43 7
    public function fromState(): State
44
    {
45 7
        return $this->fromState;
46
    }
47
48 7
    public function toState(): State
49
    {
50 7
        return $this->toState;
51
    }
52
}
53