Completed
Pull Request — master (#6)
by
unknown
09:19
created

StateHistoryManager::storeHistory()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 11
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 11
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 7
nc 1
nop 1
1
<?php
2
3
namespace Sebdesign\SM\Services;
4
5
use SM\Event\TransitionEvent;
6
7
class StateHistoryManager
8
{
9
    /**
10
     * @param \SM\Event\TransitionEvent $event
11
     */
12
    public function storeHistory(TransitionEvent $event)
13
    {
14
        $sm = $event->getStateMachine();
15
        $model = $sm->getObject();
16
17
        $model->addHistoryLine([
18
            'transition' => $event->getTransition(),
19
            'from' => $event->getState(),
20
            'to' => $sm->getState(),
21
        ]);
22
    }
23
}
24