From c3d758f54e6d7fbd3c7adad055f80544f1457a70 Mon Sep 17 00:00:00 2001 From: Samuel Mwangi Date: Sun, 2 Jul 2023 16:12:02 +0300 Subject: [PATCH] Rename validity variable --- src/Domain/WebRTCToken.php | 10 +++++----- tests/WebRTCTokenTest.php | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Domain/WebRTCToken.php b/src/Domain/WebRTCToken.php index 341eb24..633a9f1 100644 --- a/src/Domain/WebRTCToken.php +++ b/src/Domain/WebRTCToken.php @@ -17,8 +17,8 @@ class WebRTCToken { public ?string $username = null; public ?string $clientName; - private int $maxValidityDurationSeconds = 86400; - public int $validity = 86400; + private int $maxlifeTimeSec = 86400; + public int $lifeTimeSec = 86400; public ?PhoneNumber $phone; public function for(?string $name = null): static @@ -45,11 +45,11 @@ public function validFor(int $seconds): static throw new InvalidArgumentException("Negative duration values not allowed"); } - if ($seconds > $this->maxValidityDurationSeconds) { + if ($seconds > $this->maxlifeTimeSec) { throw new InvalidArgumentException("The maximum allowed token duration is 24 Hours"); } - $this->validity = $seconds; + $this->lifeTimeSec = $seconds; return $this; } @@ -101,7 +101,7 @@ public function outgoing(): string public function expire(): string { - return "{$this->validity}s"; + return "{$this->lifeTimeSec}s"; } public function data(): array diff --git a/tests/WebRTCTokenTest.php b/tests/WebRTCTokenTest.php index fcf2c88..f163623 100644 --- a/tests/WebRTCTokenTest.php +++ b/tests/WebRTCTokenTest.php @@ -33,7 +33,7 @@ expect($object) ->toBeInstanceOf(WebRTCToken::class) - ->validity->toBe($number) + ->lifeTimeSec->toBe($number) ->expire()->toBe("{$number}s"); })->with('webrtc-token-duration');