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

MonitoredProcess   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 2
Dependencies 1

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 2
lcom 2
cbo 1
dl 0
loc 34
ccs 10
cts 10
cp 1
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A execute() 0 7 1
A rollBack() 0 7 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