ArrayDigitList
class ArrayDigitList extends AbstractDigitList (View source)
Handles a list of digits provided as an array.
Properties
protected array | $digits | from AbstractDigitList | |
protected int[] | $valueMap | from AbstractDigitList | |
protected bool | $caseSensitive | from AbstractDigitList | |
protected bool | $stringConflict | from AbstractDigitList |
Methods
Sets the value map and determines if it's case sensitive.
Tells if there is conflict that prevents numbers from being represented as a string.
Returns the digit that represents the given value.
Returns the value for the given digit.
Creates a new instance of ArrayDigitList.
Details
in AbstractDigitList at line 29
protected
setValueMap(array $map)
Sets the value map and determines if it's case sensitive.
in AbstractDigitList at line 36
bool
hasStringConflict()
Tells if there is conflict that prevents numbers from being represented as a string.
in AbstractDigitList at line 41
bool
isCaseSensitive()
Tells if the digits are case sensitive or not.
in AbstractDigitList at line 46
array
getDigits()
Returns all the digits in the list.
in AbstractDigitList at line 51
mixed
getDigit(int $value)
Returns the digit that represents the given value.
at line 121
int
getValue(mixed $digit)
Returns the value for the given digit.
in AbstractDigitList at line 77
int
count()
Returns the number of different digits.
at line 24
__construct(array $digits)
Creates a new instance of ArrayDigitList.
The list of digits is provided as an array. The index provides value for the digits and the values provide the digits themselves. Any kind of value is an acceptable digit, but note that the digits are considered duplicate if their values are equal using a loose comparison.