Option
in package
AbstractYes
Tags
Table of Contents
Methods
- filter() : Option<string|int, T>
- flatMap() : Option<string|int, O>
- flatten() : Option
- getNullable() : T|null
- isNone() : bool
- isSome() : bool
- isSomeAnd() : bool
- map() : Option<string|int, O>
- mapOr() : O
- None() : Option<string|int, mixed>
- Some() : Option<string|int, U>
- try() : Option<string|int, U>
- unwrap() : T
- Get the value out of the Option if `Some` variant.
- unwrapOr() : T
- Get the value out of the Option if `Some` variant.
- unwrapOrElse() : T
- Get the value out of the Option if `Some` variant.
- with() : Option<string|int, O>
- wrap() : Option<string|int, U>
- Wraps a value into an Option.
- wrapProcedure() : Option<string|int, U>
- Wraps the return value of the given procedure into an Option.
Methods
filter()
public
abstract filter(callable $predicate) : Option<string|int, T>
Parameters
- $predicate : callable
Return values
Option<string|int, T>flatMap()
public
abstract flatMap(callable $f) : Option<string|int, O>
Parameters
- $f : callable
Tags
Return values
Option<string|int, O>flatten()
public
abstract flatten() : Option
Tags
Return values
OptiongetNullable()
public
abstract getNullable() : T|null
Return values
T|nullisNone()
public
abstract isNone() : bool
Tags
Return values
boolisSome()
public
abstract isSome() : bool
Tags
Return values
boolisSomeAnd()
public
abstract isSomeAnd(callable $predicate) : bool
Parameters
- $predicate : callable
Tags
Return values
boolmap()
public
abstract map(callable $f) : Option<string|int, O>
Parameters
- $f : callable
Tags
Return values
Option<string|int, O>mapOr()
public
abstract mapOr(O $default, callable $f) : O
Parameters
- $default : O
- $f : callable
Tags
Return values
ONone()
public
final static None() : Option<string|int, mixed>
Return values
Option<string|int, mixed>Some()
public
final static Some(U $value) : Option<string|int, U>
Parameters
- $value : U
Tags
Return values
Option<string|int, U>try()
public
final static try(callable $procedure) : Option<string|int, U>
Parameters
- $procedure : callable
Tags
Return values
Option<string|int, U>unwrap()
Get the value out of the Option if `Some` variant.
public
abstract unwrap() : T
Throws otherwise.
Tags
Return values
TunwrapOr()
Get the value out of the Option if `Some` variant.
public
abstract unwrapOr(T $default) : T
Returns the provided default value otherwise.
Parameters
- $default : T
Tags
Return values
TunwrapOrElse()
Get the value out of the Option if `Some` variant.
public
abstract unwrapOrElse(callable $f) : T
Returns the result of the provided callable otherwise.
Parameters
- $f : callable
Return values
Twith()
public
final static with(callable $expr) : Option<string|int, O>
Parameters
- $expr : callable
Tags
Return values
Option<string|int, O>wrap()
Wraps a value into an Option.
public
final static wrap(U $value[, mixed $nullValue = null ]) : Option<string|int, U>
If the value is equal to null (or to the specified $nullValue), it will return None variant.
Parameters
- $value : U
- $nullValue : mixed = null
Tags
Return values
Option<string|int, U>wrapProcedure()
Wraps the return value of the given procedure into an Option.
public
final static wrapProcedure(callable $procedure[, mixed $nullValue = null ]) : Option<string|int, U>
If the value is equal to null (or to the specified $nullValue), it will return None variant.
Parameters
- $procedure : callable
- $nullValue : mixed = null