Total Complexity | 8 |
Total Lines | 52 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
4 | final class Statistics |
||
5 | { |
||
6 | protected $duration; // <seconds>.<microseconds> |
||
7 | protected $memoryPeakUsage; // K |
||
8 | protected $result; |
||
9 | protected $timeStart; |
||
10 | protected $timeFinish; |
||
11 | protected $timeZone; |
||
12 | |||
13 | public function __construct() |
||
14 | { |
||
15 | $this->timeZone = date_default_timezone_get(); |
||
16 | } |
||
17 | |||
18 | public function finish($result) |
||
19 | { |
||
20 | $this->result = $result; |
||
21 | $this->timeFinish = $this->createCurrentTimeObject(); |
||
22 | $this->duration = $this->timeFinish->format("U.u") - $this->timeStart->format("U.u"); |
||
23 | $this->memoryPeakUsage = memory_get_peak_usage(true) / 1024; |
||
24 | } |
||
25 | |||
26 | public function getDuration() |
||
27 | { |
||
28 | return $this->duration; |
||
29 | } |
||
30 | |||
31 | public function getMemoryPeakUsage() |
||
34 | } |
||
35 | |||
36 | public function getResult() |
||
39 | } |
||
40 | |||
41 | public function start() |
||
44 | } |
||
45 | |||
46 | protected function createCurrentTimeObject() |
||
56 | } |
||
57 | } |
||
58 |