RoleVoter
in package
implements
CacheableVoterInterface
RoleVoter votes if any attribute starts with a given prefix.
Tags
Table of Contents
Interfaces
- CacheableVoterInterface
- Let voters expose the attributes and types they care about.
Properties
- $prefix : string
Methods
- __construct() : mixed
- supportsAttribute() : bool
- supportsType() : bool
- vote() : int
- {@inheritdoc}
- extractRoles() : mixed
Properties
$prefix
private
string
$prefix
Methods
__construct()
public
__construct([string $prefix = 'ROLE_' ]) : mixed
Parameters
- $prefix : string = 'ROLE_'
supportsAttribute()
public
supportsAttribute(string $attribute) : bool
Parameters
- $attribute : string
Return values
boolsupportsType()
public
supportsType(string $subjectType) : bool
Parameters
- $subjectType : string
-
The type of the subject inferred by
get_class
orget_debug_type
Return values
boolvote()
{@inheritdoc}
public
vote(TokenInterface $token, mixed $subject, array<string|int, mixed> $attributes) : int
Parameters
- $token : TokenInterface
- $subject : mixed
- $attributes : array<string|int, mixed>
Return values
intextractRoles()
protected
extractRoles(TokenInterface $token) : mixed
Parameters
- $token : TokenInterface