class AbstractMultiton implements MultitonInterface

Abstract base class for Java-style enumerations.

Methods

static  AbstractMultiton
memberByKey( string $key, boolean|null $isCaseSensitive = null)

Returns a single member by string key.

static  AbstractMultiton
memberByKeyWithDefault( string $key, MultitonInterface $default = null, boolean|null $isCaseSensitive = null)

Returns a single member by string key. Additionally returns a default if no associated member is found.

static  AbstractMultiton|null
memberOrNullByKey( string|null $key, boolean|null $isCaseSensitive = null)

Returns a single member by string key. Additionally returns null if the supplied key is null.

static  AbstractMultiton
memberBy( string $property, mixed $value, boolean|null $isCaseSensitive = null)

Returns a single member by comparison with the result of an accessor method.

static  AbstractMultiton|null
memberByWithDefault( string $property, mixed $value, MultitonInterface $default = null, boolean|null $isCaseSensitive = null)

Returns a single member by comparison with the result of an accessor method. Additionally returns a default if no associated member is found.

static  AbstractMultiton|null
memberOrNullBy( string $property, mixed $value, boolean|null $isCaseSensitive = null)

Returns a single member by comparison with the result of an accessor method. Additionally returns null if the supplied value is null.

static  AbstractMultiton
memberByPredicate( callable $predicate)

Returns a single member by predicate callback.

static  AbstractMultiton
memberByPredicateWithDefault( callable $predicate, MultitonInterface $default = null)

Returns a single member by predicate callback. Additionally returns a default if no associated member is found.

static  array<string,static>
members()

Returns an array of all members in this multiton.

static  array<string,static>
membersBy( string $property, mixed $value, boolean|null $isCaseSensitive = null)

Returns a set of members by comparison with the result of an accessor method.

static  array<string,static>
membersByPredicate( callable $predicate)

Returns a set of members by predicate callback.

static  AbstractMultiton
__callStatic( string $key, array $arguments)

Maps static method calls to members.

string
key()

Returns the string key of this member.

boolean
anyOf( MultitonInterface $a, MultitonInterface $b)

Check if this member is in the specified list of members.

boolean
anyOfArray( array $values)

Check if this member is in the specified list of members.

string
__toString()

Returns a string representation of this member.

Details

at line 38
final static AbstractMultiton memberByKey( string $key, boolean|null $isCaseSensitive = null)

Returns a single member by string key.

Parameters

string $key The string key associated with the member.
boolean|null $isCaseSensitive True if the search should be case sensitive.

Return Value

AbstractMultiton The member associated with the given string key.

Exceptions

UndefinedMemberExceptionInterface If no associated member is found.

at line 55
final static AbstractMultiton memberByKeyWithDefault( string $key, MultitonInterface $default = null, boolean|null $isCaseSensitive = null)

Returns a single member by string key. Additionally returns a default if no associated member is found.

Parameters

string $key The string key associated with the member.
MultitonInterface $default The default value to return.
boolean|null $isCaseSensitive True if the search should be case sensitive.

Return Value

AbstractMultiton The member associated with the given string key, or the default value.

at line 80
final static AbstractMultiton|null memberOrNullByKey( string|null $key, boolean|null $isCaseSensitive = null)

Returns a single member by string key. Additionally returns null if the supplied key is null.

Parameters

string|null $key The string key associated with the member, or null.
boolean|null $isCaseSensitive True if the search should be case sensitive.

Return Value

AbstractMultiton|null The member associated with the given string key, or null if the supplied key is null.

Exceptions

UndefinedMemberExceptionInterface If no associated member is found.

at line 100
final static AbstractMultiton memberBy( string $property, mixed $value, boolean|null $isCaseSensitive = null)

Returns a single member by comparison with the result of an accessor method.

Parameters

string $property The name of the property (accessor method) to match.
mixed $value The value to match.
boolean|null $isCaseSensitive True if the search should be case sensitive.

Return Value

AbstractMultiton The first member for which $member->{$property}() === $value.

Exceptions

UndefinedMemberExceptionInterface If no associated member is found.

at line 136
final static AbstractMultiton|null memberByWithDefault( string $property, mixed $value, MultitonInterface $default = null, boolean|null $isCaseSensitive = null)

Returns a single member by comparison with the result of an accessor method. Additionally returns a default if no associated member is found.

Parameters

string $property The name of the property (accessor method) to match.
mixed $value The value to match.
MultitonInterface $default The default value to return.
boolean|null $isCaseSensitive True if the search should be case sensitive.

Return Value

AbstractMultiton|null The first member for which $member->{$property}() === $value, or the default value.

at line 181
final static AbstractMultiton|null memberOrNullBy( string $property, mixed $value, boolean|null $isCaseSensitive = null)

Returns a single member by comparison with the result of an accessor method. Additionally returns null if the supplied value is null.

Parameters

string $property The name of the property (accessor method) to match.
mixed $value The value to match, or null.
boolean|null $isCaseSensitive True if the search should be case sensitive.

Return Value

AbstractMultiton|null The first member for which $member->{$property}() === $value, or null if the supplied value is null.

Exceptions

UndefinedMemberExceptionInterface If no associated member is found.

at line 217
final static AbstractMultiton memberByPredicate( callable $predicate)

Returns a single member by predicate callback.

Parameters

callable $predicate The predicate applies to the member to find a match.

Return Value

AbstractMultiton The first member for which $predicate($member) evaluates to boolean true.

Exceptions

UndefinedMemberExceptionInterface If no associated member is found.

at line 243
final static AbstractMultiton memberByPredicateWithDefault( callable $predicate, MultitonInterface $default = null)

Returns a single member by predicate callback. Additionally returns a default if no associated member is found.

Parameters

callable $predicate The predicate applied to the member to find a match.
MultitonInterface $default The default value to return.

Return Value

AbstractMultiton The first member for which $predicate($member) evaluates to boolean true, or the default value.

at line 263
final static array<string,static> members()

Returns an array of all members in this multiton.

Return Value

array<string,static> All members.

at line 287
final static array<string,static> membersBy( string $property, mixed $value, boolean|null $isCaseSensitive = null)

Returns a set of members by comparison with the result of an accessor method.

Parameters

string $property The name of the property (accessor method) to match.
mixed $value The value to match.
boolean|null $isCaseSensitive True if the search should be case sensitive.

Return Value

array<string,static> All members for which $member->{$property}() === $value.

at line 326
final static array<string,static> membersByPredicate( callable $predicate)

Returns a set of members by predicate callback.

Parameters

callable $predicate The predicate applied to the members to find matches.

Return Value

array<string,static> All members for which $predicate($member) evaluates to boolean true.

at line 350
final static AbstractMultiton __callStatic( string $key, array $arguments)

Maps static method calls to members.

Parameters

string $key The string key associated with the member.
array $arguments Ignored.

Return Value

AbstractMultiton The member associated with the given string key.

Exceptions

UndefinedMemberExceptionInterface If no associated member is found.

at line 362
final string key()

Returns the string key of this member.

Return Value

string The associated string key of this member.

at line 378
final boolean anyOf( MultitonInterface $a, MultitonInterface $b)

Check if this member is in the specified list of members.

Parameters

MultitonInterface $a
MultitonInterface $b

Return Value

boolean True if this member is in the specified list of members.

at line 392
final boolean anyOfArray( array $values)

Check if this member is in the specified list of members.

Parameters

array $values An array of members to search.

Return Value

boolean True if this member is in the specified list of members.

at line 406
string __toString()

Returns a string representation of this member.

Return Value

string