-
Notifications
You must be signed in to change notification settings - Fork 4
refactor: Code cleanup Pt4 #40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: refactor/code-cleanup
Are you sure you want to change the base?
Changes from all commits
346851e
0871513
6358c21
239e88f
08bfd2f
fd02600
6b23810
de5d16c
7652222
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| parameters: | ||
| level: 7 | ||
| level: 9 | ||
| paths: | ||
| - ./src | ||
| - ./test |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -11,12 +11,20 @@ trait DeleteInstanceTrait | |||||
| * | ||||||
| * if a remote call was not handled by the user we die hard here | ||||||
| */ | ||||||
| protected function exitRemoteCall(): void | ||||||
| protected function exitRemoteCall(): never | ||||||
| { | ||||||
| error_log("Warning: The exit procedure for a remote call was not properly handled."); | ||||||
| exit; | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Handle the delete-instance remote call and terminate the request. | ||||||
| * | ||||||
| * @param string $instanceId | ||||||
| * @param RemoteCallInterface $remoteCallHandler | ||||||
| * | ||||||
| * @return never | ||||||
| */ | ||||||
| private function deleteInstance(string $instanceId, RemoteCallInterface $remoteCallHandler): void | ||||||
|
||||||
| private function deleteInstance(string $instanceId, RemoteCallInterface $remoteCallHandler): void | |
| private function deleteInstance(string $instanceId, RemoteCallInterface $remoteCallHandler): never |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -57,7 +57,8 @@ public function getAudience(): ?string | |
| */ | ||
| public function getExpireAtTime(): ?DateTimeImmutable | ||
| { | ||
| return $this->getClaimSafe(SharedClaimsInterface::CLAIM_EXPIRE_AT); | ||
| $value = $this->getClaimSafe(SharedClaimsInterface::CLAIM_EXPIRE_AT); | ||
| return $value instanceof DateTimeImmutable ? $value : null; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -67,7 +68,8 @@ public function getExpireAtTime(): ?DateTimeImmutable | |
| */ | ||
| public function getNotBeforeTime(): ?DateTimeImmutable | ||
| { | ||
| return $this->getClaimSafe(SharedClaimsInterface::CLAIM_NOT_BEFORE); | ||
| $value = $this->getClaimSafe(SharedClaimsInterface::CLAIM_NOT_BEFORE); | ||
| return $value instanceof DateTimeImmutable ? $value : null; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -77,7 +79,8 @@ public function getNotBeforeTime(): ?DateTimeImmutable | |
| */ | ||
| public function getIssuedAtTime(): ?DateTimeImmutable | ||
| { | ||
| return $this->getClaimSafe(SharedClaimsInterface::CLAIM_ISSUED_AT); | ||
| $value = $this->getClaimSafe(SharedClaimsInterface::CLAIM_ISSUED_AT); | ||
| return $value instanceof DateTimeImmutable ? $value : null; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -87,7 +90,8 @@ public function getIssuedAtTime(): ?DateTimeImmutable | |
| */ | ||
| public function getIssuer(): ?string | ||
| { | ||
| return $this->getClaimSafe(SharedClaimsInterface::CLAIM_ISSUER); | ||
| $value = $this->getClaimSafe(SharedClaimsInterface::CLAIM_ISSUER); | ||
| return is_string($value) ? $value : null; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -97,7 +101,8 @@ public function getIssuer(): ?string | |
| */ | ||
| public function getId(): ?string | ||
| { | ||
| return $this->getClaimSafe(SharedClaimsInterface::CLAIM_JWT_ID); | ||
| $value = $this->getClaimSafe(SharedClaimsInterface::CLAIM_JWT_ID); | ||
| return is_string($value) ? $value : null; | ||
| } | ||
|
|
||
| /** | ||
|
|
@@ -107,21 +112,23 @@ public function getId(): ?string | |
| */ | ||
| public function getSubject(): ?string | ||
| { | ||
| return $this->getClaimSafe(SharedClaimsInterface::CLAIM_SUBJECT); | ||
| $value = $this->getClaimSafe(SharedClaimsInterface::CLAIM_SUBJECT); | ||
| return is_string($value) ? $value : null; | ||
| } | ||
|
|
||
| /** | ||
| * Get the role of the accessing user. | ||
| * | ||
| * If this is set to “editor”, the requesting user may manage the contents | ||
| * If this is set to "editor", the requesting user may manage the contents | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| * of the plugin instance, i.e. she has administration rights. | ||
| * The type of the accessing entity can be either a “user” or a “editor”. | ||
| * The type of the accessing entity can be either a "user" or an "editor". | ||
| * | ||
| * @return null|string | ||
| */ | ||
| public function getRole(): ?string | ||
| { | ||
| return $this->getClaimSafe(SharedClaimsInterface::CLAIM_USER_ROLE); | ||
| $value = $this->getClaimSafe(SharedClaimsInterface::CLAIM_USER_ROLE); | ||
| return is_string($value) ? $value : null; | ||
| } | ||
|
|
||
| /** | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.