mediatekformation

Voter
in package
implements VoterInterface

Voter is an abstract default implementation of a voter.

Tags
author

Roman Marintšenko inoryy@gmail.com

author

Grégoire Pineau lyrixx@lyrixx.info

Interfaces, Classes, Traits and Enums

VoterInterface
VoterInterface is the interface implemented by all voters.

Table of Contents

vote()  : int
Returns the vote for the given parameters.
supports()  : bool
Determines if the attribute and subject are supported by this voter.
voteOnAttribute()  : bool
Perform a single access check operation on a given attribute, subject and token.

Methods

vote()

Returns the vote for the given parameters.

public vote(TokenInterface $token, mixed $subject, array<string|int, mixed> $attributes) : int
Parameters
$token : TokenInterface
$subject : mixed

The subject to secure

$attributes : array<string|int, mixed>

An array of attributes associated with the method being invoked

Return values
int —

either ACCESS_GRANTED, ACCESS_ABSTAIN, or ACCESS_DENIED

supports()

Determines if the attribute and subject are supported by this voter.

protected abstract supports(string $attribute, mixed $subject) : bool
Parameters
$attribute : string

An attribute

$subject : mixed

The subject to secure, e.g. an object the user wants to access or any other PHP type

Return values
bool —

True if the attribute and subject are supported, false otherwise

voteOnAttribute()

Perform a single access check operation on a given attribute, subject and token.

protected abstract voteOnAttribute(string $attribute, mixed $subject, TokenInterface $token) : bool

It is safe to assume that $attribute and $subject already passed the "supports()" method check.

Parameters
$attribute : string
$subject : mixed
$token : TokenInterface
Return values
bool —

Search results