+22
src/Exceptions/MissingScopeException.php
+22
src/Exceptions/MissingScopeException.php
···
1
+
<?php
2
+
3
+
namespace SocialDept\AtpClient\Exceptions;
4
+
5
+
class MissingScopeException extends \Exception
6
+
{
7
+
public function __construct(
8
+
public readonly array $required,
9
+
public readonly array $granted,
10
+
?string $message = null,
11
+
) {
12
+
parent::__construct($message ?? $this->buildMessage());
13
+
}
14
+
15
+
protected function buildMessage(): string
16
+
{
17
+
$required = implode(', ', $this->required);
18
+
$granted = empty($this->granted) ? 'none' : implode(', ', $this->granted);
19
+
20
+
return "Missing required scope(s): {$required}. Granted: {$granted}.";
21
+
}
22
+
}