Completed
Push — master ( e03476...93f10a )
by Tilita
02:03
created

MonitoredProcess::rollBack()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 5
CRAP Score 1

Importance

Changes 0
Metric Value
dl 0
loc 7
ccs 5
cts 5
cp 1
rs 9.4285
c 0
b 0
f 0
cc 1
eloc 5
nc 1
nop 0
crap 1
1
<?php
2
namespace NeedleProject\Transaction;
3
4
/**
5
 * Class MonitoredProcess
6
 *
7
 * @package NeedleProject\Transaction
8
 * @author  Adrian Tilita <[email protected]>
9
 */
10
class MonitoredProcess extends Process
11
{
12
    /**
13
     * @var float Total duration for a process to be executed!
14
     */
15
    public $executionDuration = 0;
16
17
    /**
18
     * @var float Total duration for a process to be roll-back!
19
     */
20
    public $rollbackDuration = 0;
21
22
    /**
23
     * Execute the process
24
     */
25 2
    public function execute()
26
    {
27 2
        $time = microtime(true);
28 2
        parent::execute();
29 2
        $this->executionDuration = microtime(true) - $time;
30 2
        return $this;
31
    }
32
33
    /**
34
     * Rollback action
35
     */
36 1
    public function rollBack()
37
    {
38 1
        $time = microtime(true);
39 1
        parent::rollback();
40 1
        $this->rollbackDuration = microtime(true) - $time;
41 1
        return $this;
42
    }
43
}
44