Total Complexity | 5 |
Total Lines | 53 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | <?php |
||
15 | class BenchmarkService |
||
16 | { |
||
17 | /** |
||
18 | * @var mixed |
||
19 | */ |
||
20 | protected $startTime = LARAVEL_START; |
||
|
|||
21 | |||
22 | /** |
||
23 | * @var |
||
24 | */ |
||
25 | protected $endTime; |
||
26 | |||
27 | /** |
||
28 | * @var string |
||
29 | */ |
||
30 | protected $name; |
||
31 | |||
32 | /** |
||
33 | * TimeService constructor. |
||
34 | * @param string $name |
||
35 | */ |
||
36 | public function __construct(string $name) |
||
37 | { |
||
38 | $this->name = $name; |
||
39 | } |
||
40 | |||
41 | /** |
||
42 | * Get result |
||
43 | * @return mixed |
||
44 | */ |
||
45 | public function result() |
||
46 | { |
||
47 | if (!$this->endTime) { |
||
48 | $this->stop(); |
||
49 | } |
||
50 | |||
51 | return $this->endTime - $this->startTime; |
||
52 | } |
||
53 | |||
54 | /** |
||
55 | * Start measure |
||
56 | */ |
||
57 | public function start() |
||
60 | } |
||
61 | |||
62 | /** |
||
63 | * End measure |
||
64 | */ |
||
65 | public function stop() |
||
68 | } |
||
69 | |||
70 | } |