123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107 |
- <?php
- namespace OC\Diagnostics;
- use OCP\Diagnostics\IEvent;
- class Event implements IEvent {
-
- protected $id;
-
- protected $start;
-
- protected $end;
-
- protected $description;
-
- public function __construct($id, $description, $start) {
- $this->id = $id;
- $this->description = $description;
- $this->start = $start;
- }
-
- public function end($time) {
- $this->end = $time;
- }
-
- public function getStart() {
- return $this->start;
- }
-
- public function getId() {
- return $this->id;
- }
-
- public function getDescription() {
- return $this->description;
- }
-
- public function getEnd() {
- return $this->end;
- }
-
- public function getDuration() {
- if (!$this->end) {
- $this->end = microtime(true);
- }
- return $this->end - $this->start;
- }
- public function __toString() {
- return $this->getId() . ' ' . $this->getDescription() . ' ' . $this->getDuration();
- }
- }
|