LaunchDarkly PHP SDK 6.3.0

Result
in package

A Result is used to reflect the outcome of any operation.

Results can either be considered a success or a failure.

In the event of success, the Result will contain an optional, nullable value to hold any success value back to the calling function.

If the operation fails, the Result will contain an error describing the value. An optional exception may also be provided.

Table of Contents

$error  : string|null
$exception  : Exception|null
$value  : mixed
error()  : Result
Construct a failed result containing an error description and optional exception.
isSuccessful()  : bool
Determine whether this result represents success or failure by checking for the presence of an error.
success()  : Result
Construct a successful result containing the provided value.

Properties

$error read-only

public string|null $error = null

$exception read-only

public Exception|null $exception = null

$value read-only

public mixed $value

Methods

error()

Construct a failed result containing an error description and optional exception.

public static error(string $error[, Exception|null $exception = null ]) : Result
Parameters
$error : string
$exception : Exception|null = null
Return values
Result

isSuccessful()

Determine whether this result represents success or failure by checking for the presence of an error.

public isSuccessful() : bool
Return values
bool

success()

Construct a successful result containing the provided value.

public static success(mixed $value) : Result
Parameters
$value : mixed
Return values
Result

Search results