‪TYPO3CMS  ‪main
TYPO3\CMS\Core\Type\Enumeration Class Reference
Inheritance diagram for TYPO3\CMS\Core\Type\Enumeration:
TYPO3\CMS\Core\Type\TypeInterface TYPO3\CMS\Backend\Toolbar\Enumeration\InformationStatus TYPO3\CMS\Core\Resource\DuplicationBehavior TYPO3\CMS\Core\Tests\UnitDeprecated\Type\Fixture\Enumeration\CompleteEnumeration TYPO3\CMS\Core\Tests\UnitDeprecated\Type\Fixture\Enumeration\DuplicateConstantValueEnumeration TYPO3\CMS\Core\Tests\UnitDeprecated\Type\Fixture\Enumeration\InvalidConstantEnumeration TYPO3\CMS\Core\Tests\UnitDeprecated\Type\Fixture\Enumeration\MissingConstantsEnumeration TYPO3\CMS\Core\Tests\UnitDeprecated\Type\Fixture\Enumeration\MissingDefaultEnumeration TYPO3\CMS\Core\Type\Icon\IconState

Public Member Functions

 __construct ($value=null)
 
bool equals ($value)
 
string __toString ()
 

Static Public Member Functions

static array getConstants ($include_default=false)
 
static static cast ($value)
 
static string getName ($value)
 
static string getHumanReadableName ($value)
 

Protected Member Functions

 setValue ($value)
 
bool isValid ($value)
 

Static Protected Member Functions

static loadValues ()
 

Protected Attributes

mixed $value
 

Static Protected Attributes

static array $enumConstants
 

Detailed Description

Abstract class for Enumeration. Inspired by SplEnum.

The prefix "Abstract" has been left out by intention because a "type" is abstract by definition.

Deprecated:
‪will be removed in TYPO3 v14.0.

Definition at line 30 of file Enumeration.php.

Constructor & Destructor Documentation

◆ __construct()

TYPO3\CMS\Core\Type\Enumeration::__construct (   $value = null)

Member Function Documentation

◆ __toString()

string TYPO3\CMS\Core\Type\Enumeration::__toString ( )
Returns
‪string

Implements TYPO3\CMS\Core\Type\TypeInterface.

Definition at line 215 of file Enumeration.php.

References TYPO3\CMS\Core\Type\Enumeration\$value.

◆ cast()

◆ equals()

bool TYPO3\CMS\Core\Type\Enumeration::equals (   $value)

Compare if the value of the current object value equals the given value

Parameters
mixed$value‪default
Returns
‪bool

Definition at line 206 of file Enumeration.php.

References TYPO3\CMS\Core\Type\Enumeration\$value.

◆ getConstants()

static array TYPO3\CMS\Core\Type\Enumeration::getConstants (   $include_default = false)
static

Get the valid values for this enum Defaults to constants you define in your subclass override to provide custom functionality

Parameters
bool$include_default
Returns
‪array

Definition at line 174 of file Enumeration.php.

References TYPO3\CMS\Core\Type\Enumeration\$enumConstants.

Referenced by TYPO3\CMS\Core\Tests\UnitDeprecated\Type\EnumerationTest\getConstantsReturnsArrayOfPossibleValuesWithDefaultIfRequested(), and TYPO3\CMS\Core\Tests\UnitDeprecated\Type\EnumerationTest\getConstantsReturnsArrayOfPossibleValuesWithoutDefault().

◆ getHumanReadableName()

static string TYPO3\CMS\Core\Type\Enumeration::getHumanReadableName (   $value)
static

Returns the name of the constant, first char upper, underscores as spaces

Parameters
string | int$value
Returns
‪string

Definition at line 242 of file Enumeration.php.

References TYPO3\CMS\Core\Type\Enumeration\$value.

Referenced by TYPO3\CMS\Core\Tests\UnitDeprecated\Type\EnumerationTest\getHumanReadableNameProvidesNameForAvailableConstant().

◆ getName()

static string TYPO3\CMS\Core\Type\Enumeration::getName (   $value)
static

◆ isValid()

bool TYPO3\CMS\Core\Type\Enumeration::isValid (   $value)
protected

Check if the value on this enum is a valid value for the enum

Parameters
mixed$value
Returns
‪bool

Definition at line 155 of file Enumeration.php.

References TYPO3\CMS\Core\Type\Enumeration\$value.

Referenced by TYPO3\CMS\Core\Type\Enumeration\__construct().

◆ loadValues()

static TYPO3\CMS\Core\Type\Enumeration::loadValues ( )
staticprotected
Exceptions
Exception

Definition at line 72 of file Enumeration.php.

References TYPO3\CMS\Core\Type\Enumeration\$value.

◆ setValue()

TYPO3\CMS\Core\Type\Enumeration::setValue (   $value)
protected

Set the Enumeration value to the associated enumeration value by a loose comparison. The value, that is used as the enumeration value, will be of the same type like defined in the enumeration

Parameters
mixed$value
Exceptions
Exception

Definition at line 137 of file Enumeration.php.

References TYPO3\CMS\Core\Type\Enumeration\$value.

Referenced by TYPO3\CMS\Core\Type\Enumeration\__construct().

Member Data Documentation

◆ $enumConstants

array TYPO3\CMS\Core\Type\Enumeration::$enumConstants
staticprotected

Definition at line 38 of file Enumeration.php.

Referenced by TYPO3\CMS\Core\Type\Enumeration\getConstants().

◆ $value