Index

tWithScopes

MMO\oauth\classes · 1 symbol · generated 5 Oct 2026

trait

tWithScopes

tWithScopes.php:11

trait to implement iScopeProvider. Its setters record the change with markChanged(): an entity has it, another class using the trait implements it.

trait MMO\oauth\classes\tWithScopes
Namespace
MMO\oauth\classes

Index

scopes
allow($uids)Add scope if it is not already disallowed
applyScopes($scopes, $set)Apply this scopes onto a list of scopes
blameScope($uid)
clearScopes()
disallow($uids)
getScope($uid)
getScopes()Return an array of scopes associated with the token.
hasScope($uid)
isAllowed($uids)Test if all scopes are allowed
isAnyAllowed($uids)Test if any scope is allowed Scopes expressed as string can be a list of scope's uid seperated by a space (in this case, all scopes MUST be allowed).
markChanged($keys) abstractRecord that properties changed (scopes), so they are saved: aEntity::markChanged
scopesText($separator, $true, $false)
setScope($uid, $value)Set the scope's value
setScopes($scopes)

Properties1

scopes

#[MMO\core\attributes\ArrayProperty(setter: 'setScopes', schema: '{...: bool}')] protected array $scopes = []
Type
array

Methods14

allow($uids)

tWithScopes.php:100

Add scope if it is not already disallowed

function allow(object|string ...$uids): void
...$uidsobject | stringlist of scope's uid separated by space or a list of uid
returnsvoid

applyScopes($scopes, $set)

tWithScopes.php:136

Apply this scopes onto a list of scopes

function applyScopes(array &$scopes, bool $set = false): void
$scopesarraylist of {scope:uid} => {allow:bool}
$set = falseboolmergeScopes
returnsvoid

getScopes()

tWithScopes.php:40

Return an array of scopes associated with the token.

function getScopes(): array
returnsarraybool>

isAnyAllowed($uids)

tWithScopes.php:125

Test if any scope is allowed Scopes expressed as string can be a list of scope's uid seperated by a space (in this case, all scopes MUST be allowed).

function isAnyAllowed(object|string ...$uids): bool
...$uidsobject | string
returnsbool

scopesText($separator, $true, $false)

tWithScopes.php:44
function scopesText(string $separator = ' | ', string $true = '✓', string $false = '✗'): string
$separator = ' | 'string
$true = '✓'string
$false = '✗'string
returnsstring

setScope($uid, $value)

tWithScopes.php:65

Set the scope's value

function setScope(object|string $uid, ?bool $value): void
$uidobject | string
$valuenull | boolif null, remove the scope from the list of scopes
returnsvoid