Skip to content

Commit 1bc3a7b

Browse files
committed
style: reduced nested blocks
1 parent 9f367f8 commit 1bc3a7b

File tree

1 file changed

+14
-12
lines changed

1 file changed

+14
-12
lines changed

src/Introspect.php

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,22 @@ public function __construct(IntrospectClient $client, Request $request)
2525

2626
protected function getIntrospectionResult()
2727
{
28-
if ($this->result === null) {
29-
try {
30-
$this->result = $this->client->introspect($this->request->bearerToken());
31-
} catch (RequestException $e) {
32-
if ($e->hasResponse()) {
33-
$result = json_decode((string) $e->getResponse()->getBody(), true);
34-
35-
if (isset($result['error'])) {
36-
throw new AuthenticationException($result['error']['title'] ?? '');
37-
}
38-
}
28+
if ($this->result !== null) {
29+
return $this->result;
30+
}
31+
32+
try {
33+
$this->result = $this->client->introspect($this->request->bearerToken());
34+
} catch (RequestException $e) {
35+
if ($e->hasResponse()) {
36+
$result = json_decode((string) $e->getResponse()->getBody(), true);
3937

40-
throw new AuthenticationException($e->getMessage());
38+
if (isset($result['error'])) {
39+
throw new AuthenticationException($result['error']['title'] ?? '');
40+
}
4141
}
42+
43+
throw new AuthenticationException($e->getMessage());
4244
}
4345

4446
return $this->result;

0 commit comments

Comments
 (0)