-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from kbond/signed-uri-refactor
[BC BREAK] `SignedUri` Refactor
- Loading branch information
Showing
7 changed files
with
253 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,19 +2,29 @@ | |
|
||
namespace Zenstruck\Uri\Signed\Exception; | ||
|
||
use Zenstruck\Uri; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
*/ | ||
final class ExpiredUri extends VerificationFailed | ||
{ | ||
public const REASON = 'URI has expired.'; | ||
|
||
public function expiredAt(): \DateTimeImmutable | ||
private \DateTimeImmutable $expiredAt; | ||
|
||
/** | ||
* @internal | ||
*/ | ||
public function __construct(Uri $uri, \DateTimeImmutable $expiredAt, ?string $message = null, ?\Throwable $previous = null) | ||
{ | ||
$expiredAt = $this->uri()->expiresAt(); | ||
parent::__construct($uri, $message, $previous); | ||
|
||
\assert($expiredAt instanceof \DateTimeImmutable); | ||
$this->expiredAt = $expiredAt; | ||
} | ||
|
||
return $expiredAt; | ||
public function expiredAt(): \DateTimeImmutable | ||
{ | ||
return $this->expiredAt; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,7 @@ | |
|
||
namespace Zenstruck\Uri\Signed\Exception; | ||
|
||
use Zenstruck\Uri\SignedUri; | ||
use Zenstruck\Uri; | ||
|
||
/** | ||
* @author Kevin Bond <[email protected]> | ||
|
@@ -11,16 +11,19 @@ abstract class VerificationFailed extends \RuntimeException | |
{ | ||
public const REASON = ''; | ||
|
||
private SignedUri $uri; | ||
private Uri $uri; | ||
|
||
final public function __construct(SignedUri $uri, ?string $message = null, ?\Throwable $previous = null) | ||
/** | ||
* @internal | ||
*/ | ||
public function __construct(Uri $uri, ?string $message = null, ?\Throwable $previous = null) | ||
{ | ||
$this->uri = $uri; | ||
|
||
parent::__construct($message ?? static::REASON, 0, $previous); | ||
} | ||
|
||
final public function uri(): SignedUri | ||
final public function uri(): Uri | ||
{ | ||
return $this->uri; | ||
} | ||
|
Oops, something went wrong.