Skip to content

Commit

Permalink
Rename validity variable
Browse files Browse the repository at this point in the history
  • Loading branch information
SamuelMwangiW committed Jul 2, 2023
1 parent c2534a3 commit c3d758f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/Domain/WebRTCToken.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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;
}
Expand Down Expand Up @@ -101,7 +101,7 @@ public function outgoing(): string

public function expire(): string
{
return "{$this->validity}s";
return "{$this->lifeTimeSec}s";
}

public function data(): array
Expand Down
2 changes: 1 addition & 1 deletion tests/WebRTCTokenTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@

expect($object)
->toBeInstanceOf(WebRTCToken::class)
->validity->toBe($number)
->lifeTimeSec->toBe($number)
->expire()->toBe("{$number}s");
})->with('webrtc-token-duration');

Expand Down

0 comments on commit c3d758f

Please sign in to comment.