EvaluationReason
in package
implements
JsonSerializable
Describes the reason that a flag evaluation produced a particular value.
This is part of the EvaluationDetail object returned by LDClient::variationDetail().
Interfaces, Classes, Traits and Enums
- JsonSerializable
Table of Contents
- CLIENT_NOT_READY_ERROR = 'CLIENT_NOT_READY'
- A possible value for getErrorKind(): indicates that the caller tried to evaluate a flag before the client had successfully initialized.
- ERROR = 'ERROR'
- A possible value for getKind(): indicates that the flag could not be evaluated, e.g.
- EXCEPTION_ERROR = 'EXCEPTION'
- A possible value for getErrorKind(): indicates that an unexpected exception stopped flag evaluation.
- FALLTHROUGH = 'FALLTHROUGH'
- A possible value for getKind(): indicates that the flag was on but the user did not match any targets or rules.
- FLAG_NOT_FOUND_ERROR = 'FLAG_NOT_FOUND'
- A possible value for getErrorKind(): indicates that the caller provided a flag key that did not match any known flag.
- MALFORMED_FLAG_ERROR = 'MALFORMED_FLAG'
- A possible value for getErrorKind(): indicates that there was an internal inconsistency in the flag data, e.g. a rule specified a nonexistent variation. An error message will always be logged in this case.
- OFF = 'OFF'
- A possible value for getKind(): indicates that the flag was off and therefore returned its configured off value.
- PREREQUISITE_FAILED = 'PREREQUISITE_FAILED'
- A possible value for getKind(): indicates that the flag was considered off because it had at least one prerequisite flag that either was off or did not return the desired variation.
- RULE_MATCH = 'RULE_MATCH'
- A possible value for getKind(): indicates that the user matched one of the flag's rules.
- TARGET_MATCH = 'TARGET_MATCH'
- A possible value for getKind(): indicates that the user key was specifically targeted for this flag.
- USER_NOT_SPECIFIED_ERROR = 'USER_NOT_SPECIFIED'
- A possible value for getErrorKind(): indicates that the caller passed null for the user parameter, or the user lacked a key.
- WRONG_TYPE_ERROR = 'WRONG_TYPE'
- A possible value for getErrorKind(): indicates the value of the evaluation did not match the PHP type expected.
- __toString() : string
- Returns a simple string representation of this object.
- bigSegmentsEvaluationStatus() : BigSegmentsEvaluationStatus|null
- Describes the validity of Big Segment information, if and only if the flag evaluation required querying at least one Big Segment. Otherwise it returns null. Possible values are defined by {@see BigSegmentsEvaluationStatus}.
- error() : EvaluationReason
- Creates a new instance of the ERROR reason.
- fallthrough() : EvaluationReason
- Creates a new instance of the FALLTHROUGH reason.
- getErrorKind() : string|null
- Returns a constant indicating the nature of the error, if getKind() is OFF. Otherwise returns null.
- getKind() : string
- Returns a constant indicating the general category of the reason, such as OFF.
- getPrerequisiteKey() : string|null
- Returns the key of the prerequisite feature flag that failed, if getKind() is PREREQUISITE_FAILED. Otherwise returns null.
- getRuleId() : string|null
- Returns the unique identifier of the rule that was matched, if getKind() is RULE_MATCH.
- getRuleIndex() : int|null
- Returns the positional index of the rule that was matched (0 for the first), if getKind() is RULE_MATCH. Otherwise returns null.
- isInExperiment() : bool
- Returns true if the evaluation resulted in an experiment rollout *and* served one of the variations in the experiment. Otherwise it returns false.
- jsonSerialize() : array<string|int, mixed>
- Returns a JSON representation of this object. This method is used automatically if you call json_encode().
- off() : EvaluationReason
- Creates a new instance of the OFF reason.
- prerequisiteFailed() : EvaluationReason
- Creates a new instance of the PREREQUISITE_FAILED reason.
- ruleMatch() : EvaluationReason
- Creates a new instance of the RULE_MATCH reason.
- targetMatch() : EvaluationReason
- Creates a new instance of the TARGET_MATCH reason.
- withBigSegmentsEvaluationStatus() : EvaluationReason
- Returns a new EvaluationReason instance matching all the properties of this one, except for the big segments evaluation status.
Constants
CLIENT_NOT_READY_ERROR
A possible value for getErrorKind(): indicates that the caller tried to evaluate a flag before the client had successfully initialized.
public
string
CLIENT_NOT_READY_ERROR
= 'CLIENT_NOT_READY'
ERROR
A possible value for getKind(): indicates that the flag could not be evaluated, e.g.
public
string
ERROR
= 'ERROR'
because it does not exist or due to an unexpected error.
EXCEPTION_ERROR
A possible value for getErrorKind(): indicates that an unexpected exception stopped flag evaluation.
public
string
EXCEPTION_ERROR
= 'EXCEPTION'
FALLTHROUGH
A possible value for getKind(): indicates that the flag was on but the user did not match any targets or rules.
public
string
FALLTHROUGH
= 'FALLTHROUGH'
FLAG_NOT_FOUND_ERROR
A possible value for getErrorKind(): indicates that the caller provided a flag key that did not match any known flag.
public
string
FLAG_NOT_FOUND_ERROR
= 'FLAG_NOT_FOUND'
MALFORMED_FLAG_ERROR
A possible value for getErrorKind(): indicates that there was an internal inconsistency in the flag data, e.g. a rule specified a nonexistent variation. An error message will always be logged in this case.
public
string
MALFORMED_FLAG_ERROR
= 'MALFORMED_FLAG'
OFF
A possible value for getKind(): indicates that the flag was off and therefore returned its configured off value.
public
string
OFF
= 'OFF'
PREREQUISITE_FAILED
A possible value for getKind(): indicates that the flag was considered off because it had at least one prerequisite flag that either was off or did not return the desired variation.
public
string
PREREQUISITE_FAILED
= 'PREREQUISITE_FAILED'
RULE_MATCH
A possible value for getKind(): indicates that the user matched one of the flag's rules.
public
string
RULE_MATCH
= 'RULE_MATCH'
TARGET_MATCH
A possible value for getKind(): indicates that the user key was specifically targeted for this flag.
public
string
TARGET_MATCH
= 'TARGET_MATCH'
USER_NOT_SPECIFIED_ERROR
A possible value for getErrorKind(): indicates that the caller passed null for the user parameter, or the user lacked a key.
public
string
USER_NOT_SPECIFIED_ERROR
= 'USER_NOT_SPECIFIED'
WRONG_TYPE_ERROR
A possible value for getErrorKind(): indicates the value of the evaluation did not match the PHP type expected.
public
mixed
WRONG_TYPE_ERROR
= 'WRONG_TYPE'
Methods
__toString()
Returns a simple string representation of this object.
public
__toString() : string
Return values
string —bigSegmentsEvaluationStatus()
Describes the validity of Big Segment information, if and only if the flag evaluation required querying at least one Big Segment. Otherwise it returns null. Possible values are defined by {@see BigSegmentsEvaluationStatus}.
public
bigSegmentsEvaluationStatus() : BigSegmentsEvaluationStatus|null
Big Segments are a specific kind of context segments. For more information, read the LaunchDarkly documentation: https://docs.launchdarkly.com/home/users/big-segments
Return values
BigSegmentsEvaluationStatus|null —error()
Creates a new instance of the ERROR reason.
public
static error(string $errorKind) : EvaluationReason
Parameters
- $errorKind : string
Return values
EvaluationReason —fallthrough()
Creates a new instance of the FALLTHROUGH reason.
public
static fallthrough([bool $inExperiment = false ]) : EvaluationReason
Parameters
- $inExperiment : bool = false
Return values
EvaluationReason —getErrorKind()
Returns a constant indicating the nature of the error, if getKind() is OFF. Otherwise returns null.
public
getErrorKind() : string|null
Return values
string|null —getKind()
Returns a constant indicating the general category of the reason, such as OFF.
public
getKind() : string
Return values
string —getPrerequisiteKey()
Returns the key of the prerequisite feature flag that failed, if getKind() is PREREQUISITE_FAILED. Otherwise returns null.
public
getPrerequisiteKey() : string|null
Return values
string|null —getRuleId()
Returns the unique identifier of the rule that was matched, if getKind() is RULE_MATCH.
public
getRuleId() : string|null
Otherwise returns null.
Return values
string|null —getRuleIndex()
Returns the positional index of the rule that was matched (0 for the first), if getKind() is RULE_MATCH. Otherwise returns null.
public
getRuleIndex() : int|null
Return values
int|null —isInExperiment()
Returns true if the evaluation resulted in an experiment rollout *and* served one of the variations in the experiment. Otherwise it returns false.
public
isInExperiment() : bool
Return values
bool —jsonSerialize()
Returns a JSON representation of this object. This method is used automatically if you call json_encode().
public
jsonSerialize() : array<string|int, mixed>
Return values
array<string|int, mixed> —off()
Creates a new instance of the OFF reason.
public
static off() : EvaluationReason
Return values
EvaluationReason —prerequisiteFailed()
Creates a new instance of the PREREQUISITE_FAILED reason.
public
static prerequisiteFailed(string $prerequisiteKey) : EvaluationReason
Parameters
- $prerequisiteKey : string
Return values
EvaluationReason —ruleMatch()
Creates a new instance of the RULE_MATCH reason.
public
static ruleMatch(null|int $ruleIndex, null|string $ruleId[, bool $inExperiment = false ]) : EvaluationReason
Parameters
- $ruleIndex : null|int
- $ruleId : null|string
- $inExperiment : bool = false
Return values
EvaluationReason —targetMatch()
Creates a new instance of the TARGET_MATCH reason.
public
static targetMatch() : EvaluationReason
Return values
EvaluationReason —withBigSegmentsEvaluationStatus()
Returns a new EvaluationReason instance matching all the properties of this one, except for the big segments evaluation status.
public
withBigSegmentsEvaluationStatus(BigSegmentsEvaluationStatus $bigSegmentsEvaluationStatus) : EvaluationReason
Parameters
- $bigSegmentsEvaluationStatus : BigSegmentsEvaluationStatus