Skip to content

Commit ae0115a

Browse files
add token deleter
1 parent f5f5585 commit ae0115a

File tree

4 files changed

+35
-27
lines changed

4 files changed

+35
-27
lines changed

src/Results/Authentication/AuthTokenResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ class AuthTokenResponse extends BaseResults
3131
*/
3232
public function __construct(AuthTokenResponseBuilder $builder)
3333
{
34-
parent::__construct($builder->isValidationSucceed(), $builder->getCause());
34+
parent::__construct($builder->isValidationSucceed(), $builder->getCause(), $builder->getTokenId());
3535
$this->userId = $builder->getUserId();
3636
$this->newToken = $builder->getNewToken();
3737
}

src/Results/BaseResults.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -22,27 +22,27 @@ class BaseResults
2222
private ?string $cause;
2323

2424
/**
25-
* @var Exception|null Contains an exception explaining why the validation process failed.
25+
* @var string|null Contains the ID of the token that was validated.
2626
*/
27-
private ?Exception $exception;
27+
private ?string $tokenId;
2828

2929
/**
30-
* @var string|null Contains the ID of the token that was validated.
30+
* @var Exception|null Contains an exception explaining why the validation process failed.
3131
*/
32-
private ?string $tokenId;
32+
private ?Exception $exception;
3333

3434
/**
3535
* BaseResults constructor.
3636
*
3737
* @param bool $validationSucceed Indicates if the validation process succeeded or not.
3838
* @param string|null $cause Contains a message explaining why the validation process failed.
3939
*/
40-
public function __construct(bool $validationSucceed, ?string $cause = null, ?Exception $exception = null, ?string $tokenId = null)
40+
public function __construct(bool $validationSucceed, ?string $cause = null, ?string $tokenId = null, ?Exception $exception = null)
4141
{
4242
$this->validationSucceed = $validationSucceed;
4343
$this->cause = $cause;
44-
$this->exception = $exception;
4544
$this->tokenId = $tokenId;
45+
$this->exception = $exception;
4646
}
4747

4848
/**
@@ -66,23 +66,23 @@ public function getCause(): ?string
6666
}
6767

6868
/**
69-
* Getter method for the exception caused a validation failure.
69+
* Getter method for the ID of the token that was validated.
7070
*
71-
* @return Exception|null Contains an exception explaining why the validation process failed.
71+
* @return string|null Contains the ID of the token that was validated.
7272
*/
73-
public function getException(): ?Exception
73+
public function getTokenId(): ?string
7474
{
75-
return $this->exception;
75+
return $this->tokenId;
7676
}
7777

7878
/**
79-
* Getter method for the ID of the token that was validated.
79+
* Getter method for the exception caused a validation failure.
8080
*
81-
* @return string|null Contains the ID of the token that was validated.
81+
* @return Exception|null Contains an exception explaining why the validation process failed.
8282
*/
83-
public function getTokenId(): ?string
83+
public function getException(): ?Exception
8484
{
85-
return $this->tokenId;
85+
return $this->exception;
8686
}
8787

8888
/**

src/Results/BaseResultsBuilder.php

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ class BaseResultsBuilder
1313
{
1414
private bool $validationSucceed;
1515
private ?string $cause;
16-
private ?Exception $exception;
1716
private ?string $tokenId;
17+
private ?Exception $exception;
1818

1919
/**
2020
* BaseResultsBuilder constructor.
@@ -23,8 +23,8 @@ public function __construct()
2323
{
2424
$this->validationSucceed = false;
2525
$this->cause = null;
26-
$this->exception = null;
2726
$this->tokenId = null;
27+
$this->exception = null;
2828
}
2929

3030
/**
@@ -52,26 +52,26 @@ public function setCause(?string $cause): self
5252
}
5353

5454
/**
55-
* Sets the exception caused a validation failure.
55+
* Sets the ID of the token that was validated.
5656
*
57-
* @param Exception|null $exception Contains an exception explaining why the validation process failed.
57+
* @param string|null $tokenId Contains the ID of the token that was validated.
5858
* @return $this This instance of the BaseResultsBuilder object.
5959
*/
60-
public function setException(?Exception $exception): self
60+
public function setTokenId(?string $tokenId): self
6161
{
62-
$this->exception = $exception;
62+
$this->tokenId = $tokenId;
6363
return $this;
6464
}
6565

6666
/**
67-
* Sets the ID of the token that was validated.
67+
* Sets the exception caused a validation failure.
6868
*
69-
* @param string|null $tokenId Contains the ID of the token that was validated.
69+
* @param Exception|null $exception Contains an exception explaining why the validation process failed.
7070
* @return $this This instance of the BaseResultsBuilder object.
7171
*/
72-
public function setTokenId(?string $tokenId): self
72+
public function setException(?Exception $exception): self
7373
{
74-
$this->tokenId = $tokenId;
74+
$this->exception = $exception;
7575
return $this;
7676
}
7777

@@ -82,7 +82,7 @@ public function setTokenId(?string $tokenId): self
8282
*/
8383
public function build(): BaseResults
8484
{
85-
return new BaseResults($this->validationSucceed, $this->cause, $this->exception, $this->tokenId);
85+
return new BaseResults($this->validationSucceed, $this->cause, $this->tokenId, $this->exception);
8686
}
8787

8888
/**
@@ -100,4 +100,12 @@ public function getCause(): ?string
100100
{
101101
return $this->cause;
102102
}
103+
104+
/**
105+
* @return string|null
106+
*/
107+
public function getTokenId(): ?string
108+
{
109+
return $this->tokenId;
110+
}
103111
}

src/Results/Confirmation/ConfirmationTokenResponse.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class ConfirmationTokenResponse extends BaseResults
2020

2121
public function __construct(ConfirmationTokenResponseBuilder $builder)
2222
{
23-
parent::__construct($builder->isValidationSucceed(), $builder->getCause());
23+
parent::__construct($builder->isValidationSucceed(), $builder->getCause(), $builder->getTokenId());
2424
$this->userId = $builder->getUserId();
2525
$this->whatFor = $builder->getWhatFor();
2626
}

0 commit comments

Comments
 (0)