You've already forked Php-Template
All checks were successful
🧪✨ Tests Workflow / 🛡️ 🔒 Library Audit (push) Successful in 2m55s
🧪✨ Tests Workflow / 🛡️ 🔒 License Check (push) Successful in 2m55s
🧪✨ Tests Workflow / 📝 ✨ Code Lint (push) Successful in 2m58s
🧪✨ Tests Workflow / 🐙 🔍 Code Sniffer (push) Successful in 3m1s
🧪✨ Tests Workflow / 🧪 ✅ Unit Tests (push) Successful in 2m40s
🧪✨ Tests Workflow / 🧪 ✨ Database Migrations (push) Successful in 3m0s
Reviewed-on: #21 Co-authored-by: Ron Rise <ron@siteworxpro.com> Co-committed-by: Ron Rise <ron@siteworxpro.com>
39 lines
843 B
PHP
39 lines
843 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Siteworxpro\App\Attributes\Guards;
|
|
|
|
use Attribute;
|
|
|
|
#[Attribute(Attribute::TARGET_CLASS | Attribute::TARGET_METHOD | Attribute::IS_REPEATABLE)]
|
|
readonly class Scope
|
|
{
|
|
/**
|
|
* @param array<int, string> $scopes the required scopes
|
|
* @param string $claim the claim to check for scopes
|
|
* @param string $separator the separator used to split scopes in the claim
|
|
*/
|
|
public function __construct(
|
|
private array $scopes = [],
|
|
private string $claim = 'scope',
|
|
private string $separator = ' '
|
|
) {
|
|
}
|
|
|
|
public function getScopes(): array
|
|
{
|
|
return $this->scopes;
|
|
}
|
|
|
|
public function getClaim(): string
|
|
{
|
|
return $this->claim;
|
|
}
|
|
|
|
public function getSeparator(): string
|
|
{
|
|
return $this->separator;
|
|
}
|
|
}
|