Explore Server Side Testing SDK for PHP

SegmentVoter extends AbstractVoter

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
evaluateConditionGroup()  : bool
Evaluate a group of conditions (all conditions in a group are OR'd together)
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
groupConditionsByOperator()  : array<string|int, mixed>
Group conditions by operator precedence OR conditions are grouped together, AND creates new groups
matchesRegex()  : bool
Safely match a value against a regex pattern Automatically adds delimiters if they're missing

Properties

Methods

getName()

Get the name of the voter

public getName() : string
Return values
string

compareValues()

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
bool

evaluateCondition()

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
bool

evaluateConditionGroup()

Evaluate a group of conditions (all conditions in a group are OR'd together)

private evaluateConditionGroup(Context $context, array<string|int, mixed> $group) : bool
Parameters
$context : Context
$group : array<string|int, mixed>
Return values
bool

evaluateSegment()

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
bool

getContextParamClass()

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|null

getContextValue()

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>
Return values
mixed|null

groupConditionsByOperator()

Group conditions by operator precedence OR conditions are grouped together, AND creates new groups

private groupConditionsByOperator(array<string|int, mixed> $segment) : array<string|int, mixed>
Parameters
$segment : array<string|int, mixed>
Return values
array<string|int, mixed>

matchesRegex()

Safely match a value against a regex pattern Automatically adds delimiters if they're missing

private matchesRegex(string $value, string $pattern) : bool
Parameters
$value : string

The value to test

$pattern : string

The regex pattern

Return values
bool

        
On this page

Search results