Skip to content

Commit

Permalink
Added an ability to get timestamp as it is (#863)
Browse files Browse the repository at this point in the history
* Added an ability to get timestamp as it is

* Fix style
  • Loading branch information
oleksandr-mykhailenko authored May 26, 2023
1 parent 2323876 commit 92a5f54
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/Model/Event/Event.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ final class Event
private $storage;
private $method;
private $logLevel;
private $rawTimestamp;

private function __construct()
{
Expand Down Expand Up @@ -68,6 +69,7 @@ public static function create(array $data): self
$model->url = $data['url'] ?? '';
$model->storage = $data['storage'] ?? [];
$model->logLevel = $data['log-level'] ?? '';
$model->rawTimestamp = $data['timestamp'];

return $model;
}
Expand Down Expand Up @@ -199,4 +201,22 @@ public function getLogLevel(): string
{
return $this->logLevel;
}

/**
* Return timestamp as it is.
*
* @return mixed
*/
public function getRawTimestamp()
{
return $this->rawTimestamp;
}

/**
* @param mixed $rawTimestamp
*/
public function setRawTimestamp($rawTimestamp): void
{
$this->rawTimestamp = $rawTimestamp;
}
}
1 change: 1 addition & 0 deletions tests/Model/Event/EventResponseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,6 @@ public function testCreate()
$event = $events[0];
$this->assertEquals('czsjqFATSlC3QtAK-C80nw', $event->getId());
$this->assertEquals('info', $event->getLogLevel());
$this->assertNotEquals($event->getRawTimestamp(), $event->getTimestamp());
}
}

0 comments on commit 92a5f54

Please sign in to comment.