You are viewing the documentation for an older version of this package. You can check the version you are using with the following command:
composer show spatie/enum
##__toString()
will return the enum value.
echo WeekDayEnum::make(1);
##getIndex()
will return the enum index and could be overridden to customize the index.
WeekDayEnum::monday()->getIndex();
##getIndices()
will return all indices available on the enum.
WeekDayEnum::getIndices();
##getValue()
will return the enum value and could be overridden to customize the value.
WeekDayEnum::monday()->getValue();
##getValues()
will return all values available on the enum.
WeekDayEnum::getValues();
##isAny()
will return true
if the enum is equal with any of the given - otherwise false
.
WeekDayEnum::monday()->isAny(['monday', 0]);
##isEqual()
will return true
if the enum is equal with the given - otherwise false
.
WeekDayEnum::monday()->isEqual('tuesday');
##make()
will return an instance of the enum - further details make enum.
##toArray()
will return an associative array with the value as key and the index as value.
WeekDayEnum::toArray();