1 parent
cd55061e69
commit
204c1df755
29 files changed
+115
-75
No files matched your search
@@ -1,4 +1,5 @@
|
||||
<?php
|
||||
declare( strict_types=1 );
|
||||
|
||||
namespace Rarst\Laps\Record;
|
||||
|
||||
@@ -19,7 +20,7 @@ class Stopwatch_Record implements Record_Interface {
|
||||
* @param string $name Event name.
|
||||
* @param StopwatchEvent $stopwatch_event Stopwatch event instance.
|
||||
*/
|
||||
public function __construct( $name, StopwatchEvent $stopwatch_event ) {
|
||||
public function __construct( string $name, StopwatchEvent $stopwatch_event ) {
|
||||
$this->name = $name;
|
||||
$this->stopwatch_event = $stopwatch_event;
|
||||
}
|
||||
@@ -27,14 +28,14 @@ class Stopwatch_Record implements Record_Interface {
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function get_name() {
|
||||
public function get_name(): string {
|
||||
return $this->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function get_description() {
|
||||
public function get_description(): string {
|
||||
|
||||
$duration = round( $this->stopwatch_event->getDuration() );
|
||||
$memory = $this->stopwatch_event->getMemory() / 1024 / 1024;
|
||||
@@ -45,21 +46,21 @@ class Stopwatch_Record implements Record_Interface {
|
||||
/**
|
||||
* @return float Timestamp of record start.
|
||||
*/
|
||||
public function get_origin() {
|
||||
public function get_origin(): float {
|
||||
return $this->stopwatch_event->getOrigin() / 1000; // ms to s.
|
||||
}
|
||||
|
||||
/**
|
||||
* @return float Record duration in seconds.
|
||||
*/
|
||||
public function get_duration() {
|
||||
public function get_duration(): float {
|
||||
return $this->stopwatch_event->getDuration() / 1000; // ms to s.
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function get_category() {
|
||||
public function get_category(): string {
|
||||
return $this->stopwatch_event->getCategory();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user