Skip to content

Commit 5012bc4

Browse files
committed
Revert interface changes, mark implementation methods
1 parent b0ad41f commit 5012bc4

File tree

2 files changed

+36
-18
lines changed

2 files changed

+36
-18
lines changed

src/Builder.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -18,65 +18,49 @@ interface Builder
1818
* Appends new items to audience
1919
*
2020
* @param non-empty-string ...$audiences
21-
*
22-
* @pure
2321
*/
2422
public function permittedFor(string ...$audiences): Builder;
2523

2624
/**
2725
* Configures the expiration time
28-
*
29-
* @pure
3026
*/
3127
public function expiresAt(DateTimeImmutable $expiration): Builder;
3228

3329
/**
3430
* Configures the token id
3531
*
3632
* @param non-empty-string $id
37-
*
38-
* @pure
3933
*/
4034
public function identifiedBy(string $id): Builder;
4135

4236
/**
4337
* Configures the time that the token was issued
44-
*
45-
* @pure
4638
*/
4739
public function issuedAt(DateTimeImmutable $issuedAt): Builder;
4840

4941
/**
5042
* Configures the issuer
5143
*
5244
* @param non-empty-string $issuer
53-
*
54-
* @pure
5545
*/
5646
public function issuedBy(string $issuer): Builder;
5747

5848
/**
5949
* Configures the time before which the token cannot be accepted
60-
*
61-
* @pure
6250
*/
6351
public function canOnlyBeUsedAfter(DateTimeImmutable $notBefore): Builder;
6452

6553
/**
6654
* Configures the subject
6755
*
6856
* @param non-empty-string $subject
69-
*
70-
* @pure
7157
*/
7258
public function relatedTo(string $subject): Builder;
7359

7460
/**
7561
* Configures a header item
7662
*
7763
* @param non-empty-string $name
78-
*
79-
* @pure
8064
*/
8165
public function withHeader(string $name, mixed $value): Builder;
8266

@@ -86,8 +70,6 @@ public function withHeader(string $name, mixed $value): Builder;
8670
* @param non-empty-string $name
8771
*
8872
* @throws RegisteredClaimGiven When trying to set a registered claim.
89-
*
90-
* @pure
9173
*/
9274
public function withClaim(string $name, mixed $value): Builder;
9375

src/Token/Builder.php

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ public function __construct(private readonly Encoder $encoder, private readonly
2929
{
3030
}
3131

32+
/**
33+
* @inheritDoc
34+
* @pure
35+
*/
3236
public function permittedFor(string ...$audiences): BuilderInterface
3337
{
3438
$configured = $this->claims[RegisteredClaims::AUDIENCE] ?? [];
@@ -37,36 +41,64 @@ public function permittedFor(string ...$audiences): BuilderInterface
3741
return $this->setClaim(RegisteredClaims::AUDIENCE, array_merge($configured, $toAppend));
3842
}
3943

44+
/**
45+
* @inheritDoc
46+
* @pure
47+
*/
4048
public function expiresAt(DateTimeImmutable $expiration): BuilderInterface
4149
{
4250
return $this->setClaim(RegisteredClaims::EXPIRATION_TIME, $expiration);
4351
}
4452

53+
/**
54+
* @inheritDoc
55+
* @pure
56+
*/
4557
public function identifiedBy(string $id): BuilderInterface
4658
{
4759
return $this->setClaim(RegisteredClaims::ID, $id);
4860
}
4961

62+
/**
63+
* @inheritDoc
64+
* @pure
65+
*/
5066
public function issuedAt(DateTimeImmutable $issuedAt): BuilderInterface
5167
{
5268
return $this->setClaim(RegisteredClaims::ISSUED_AT, $issuedAt);
5369
}
5470

71+
/**
72+
* @inheritDoc
73+
* @pure
74+
*/
5575
public function issuedBy(string $issuer): BuilderInterface
5676
{
5777
return $this->setClaim(RegisteredClaims::ISSUER, $issuer);
5878
}
5979

80+
/**
81+
* @inheritDoc
82+
* @pure
83+
*/
6084
public function canOnlyBeUsedAfter(DateTimeImmutable $notBefore): BuilderInterface
6185
{
6286
return $this->setClaim(RegisteredClaims::NOT_BEFORE, $notBefore);
6387
}
6488

89+
/**
90+
* @inheritDoc
91+
* @pure
92+
*/
6593
public function relatedTo(string $subject): BuilderInterface
6694
{
6795
return $this->setClaim(RegisteredClaims::SUBJECT, $subject);
6896
}
6997

98+
/**
99+
* @inheritDoc
100+
* @pure
101+
*/
70102
public function withHeader(string $name, mixed $value): BuilderInterface
71103
{
72104
$new = clone $this;
@@ -75,6 +107,10 @@ public function withHeader(string $name, mixed $value): BuilderInterface
75107
return $new;
76108
}
77109

110+
/**
111+
* @inheritDoc
112+
* @pure
113+
*/
78114
public function withClaim(string $name, mixed $value): BuilderInterface
79115
{
80116
if (in_array($name, RegisteredClaims::ALL, true)) {

0 commit comments

Comments
 (0)