Result   A
last analyzed

Complexity

Total Complexity 10

Size/Duplication

Total Lines 135
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 0

Test Coverage

Coverage 100%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 10
c 1
b 0
f 0
lcom 1
cbo 0
dl 0
loc 135
ccs 28
cts 28
cp 1
rs 10

10 Methods

Rating   Name   Duplication   Size   Complexity  
A __construct() 0 11 1
A getName() 0 4 1
A getStartTime() 0 4 1
A getEndTime() 0 4 1
A getElapsed() 0 4 1
A getErrorCount() 0 4 1
A getSuccessCount() 0 4 1
A getTotalProcessedCount() 0 4 1
A hasErrors() 0 4 1
A getExceptions() 0 4 1
1
<?php
2
3
namespace Ddeboer\DataImport;
4
5
use Ddeboer\DataImport\Exception\ExceptionInterface;
6
7
/**
8
 * Simple Container for Workflow Results
9
 *
10
 * @author Aydin Hassan <[email protected]>
11
 */
12
class Result
13
{
14
    /**
15
     * Identifier given to the import/export
16
     *
17
     * @var string
18
     */
19
    protected $name;
20
21
    /**
22
     * @var \DateTime
23
     */
24
    protected $startTime;
25
26
    /**
27
     * @var \DateTime
28
     */
29
    protected $endTime;
30
31
    /**
32
     * @var \DateInterval
33
     */
34
    protected $elapsed;
35
36
    /**
37
     * @var integer
38
     */
39
    protected $errorCount = 0;
40
41
    /**
42
     * @var integer
43
     */
44
    protected $successCount = 0;
45
46
    /**
47
     * @var integer
48
     */
49
    protected $totalProcessedCount = 0;
50
51
    /**
52
     * @var \SplObjectStorage
53
     */
54
    protected $exceptions;
55
56
    /**
57
     * @param string            $name
58
     * @param \DateTime         $startTime
59
     * @param \DateTime         $endTime
60
     * @param integer           $totalCount
61
     * @param \SplObjectStorage $exceptions
62
     */
63 15
    public function __construct($name, \DateTime $startTime, \DateTime $endTime, $totalCount, \SplObjectStorage $exceptions)
64
    {
65 15
        $this->name                = $name;
66 15
        $this->startTime           = $startTime;
67 15
        $this->endTime             = $endTime;
68 15
        $this->elapsed             = $startTime->diff($endTime);
69 15
        $this->totalProcessedCount = $totalCount;
70 15
        $this->errorCount          = count($exceptions);
71 15
        $this->successCount        = $totalCount - $this->errorCount;
72 15
        $this->exceptions          = $exceptions;
73 15
    }
74
75
    /**
76
     * @return string
77
     */
78 2
    public function getName()
79
    {
80 2
        return $this->name;
81
    }
82
83
    /**
84
     * @return \DateTime
85
     */
86 2
    public function getStartTime()
87
    {
88 2
        return $this->startTime;
89
    }
90
91
    /**
92
     * @return \DateTime
93
     */
94 2
    public function getEndTime()
95
    {
96 2
        return $this->endTime;
97
    }
98
99
    /**
100
     * @return \DateInterval
101
     */
102 2
    public function getElapsed()
103
    {
104 2
        return $this->elapsed;
105
    }
106
107
    /**
108
     * @return integer
109
     */
110 2
    public function getErrorCount()
111
    {
112 2
        return $this->errorCount;
113
    }
114
115
    /**
116
     * @return integer
117
     */
118 2
    public function getSuccessCount()
119
    {
120 2
        return $this->successCount;
121
    }
122
123
    /**
124
     * @return integer
125
     */
126 2
    public function getTotalProcessedCount()
127
    {
128 2
        return $this->totalProcessedCount;
129
    }
130
131
    /**
132
     * @return boolean
133
     */
134 3
    public function hasErrors()
135
    {
136 3
        return $this->errorCount > 0;
137
    }
138
139
    /**
140
     * @return \SplObjectStorage
141
     */
142 2
    public function getExceptions()
143
    {
144 2
        return $this->exceptions;
145
    }
146
}
147