SegmentVoter
extends AbstractVoter
in package
Voter for segment
Table of Contents
Properties
- $NAME : string
- $userProvider : UserProviderInterface
Methods
- __construct() : mixed
- getName() : string
- Get the name of the voter
- vote() : bool
- Vote whether an experiment should be applied based on the context
- compareValues() : bool
- Compare two values based on the comparison type
- evaluateCondition() : bool
- Evaluate a single condition against the context
- evaluateSegment() : bool
- Evaluate a segment against the context
- getContextParamClass() : string|null
- Get the context parameter class name based on parameter name
- getContextValue() : mixed|null
- Get the value from context based on parameter name
Properties
$NAME
protected
static string
$NAME
= 'segment'
$userProvider
private
UserProviderInterface
$userProvider
Methods
__construct()
public
__construct(UserProviderInterface $userProvider) : mixed
Parameters
- $userProvider : UserProviderInterface
getName()
Get the name of the voter
public
getName() : string
Return values
stringvote()
Vote whether an experiment should be applied based on the context
public
vote(Context $context, Experiment $experiment) : bool
Parameters
- $context : Context
- $experiment : Experiment
Return values
boolcompareValues()
Compare two values based on the comparison type
private
compareValues(mixed $value1, mixed $value2[, string|null $type = null ]) : bool
Parameters
- $value1 : mixed
- $value2 : mixed
- $type : string|null = null
Return values
boolevaluateCondition()
Evaluate a single condition against the context
private
evaluateCondition(Context $context, array<string|int, mixed> $condition) : bool
Parameters
- $context : Context
- $condition : array<string|int, mixed>
Return values
boolevaluateSegment()
Evaluate a segment against the context
private
evaluateSegment(Context $context, array<string|int, mixed> $segment) : bool
Parameters
- $context : Context
- $segment : array<string|int, mixed>
Return values
boolgetContextParamClass()
Get the context parameter class name based on parameter name
private
getContextParamClass(string $parameter[, Context|null $context = null ]) : string|null
Parameters
- $parameter : string
- $context : Context|null = null
-
Optional context for building the mapping
Return values
string|nullgetContextValue()
Get the value from context based on parameter name
private
getContextValue(Context $context, array<string|int, mixed> $condition) : mixed|null
Parameters
- $context : Context
- $condition : array<string|int, mixed>