BaseEnum

Type
Abstract Class
Namespace
Craft
Inherits
Craft\BaseEnum
Extended by
Craft\AssetConflictResolution, Craft\AttributeType, Craft\CacheMethod, Craft\ColumnType, Craft\ComponentType, Craft\ConfigFile, Craft\CraftPackage, Craft\ElementType, Craft\EmailerType, Craft\InstallStatus, Craft\InvalidLoginMode, Craft\LicenseKeyStatus, Craft\LogLevel, Craft\PatchManifestFileAction, Craft\PeriodType, Craft\PluginUpdateStatus, Craft\RequirementResult, Craft\SectionType, Craft\UserStatus, Craft\VersionUpdateStatus
Since
2.0

The BaseEnum class is an abstract class that all enums in Craft inherit. It provides some functionality that mimics first-class citizen enum support in PHP.

See also http://craftcms.com

View source

Public Methods

MethodDescription
getConstants()
isValidName()Checks to see if the given name is valid in the enum.
isValidValue()Checks to see if the given value is valid in the enum.

getConstants()

Signature

public static array, null getConstants ( )

isValidName()

Checks to see if the given name is valid in the enum.

View source

Arguments

  • $name – The name to search for.
  • $strict (boolean) – Defaults to false. If set to true, will do a case sensitive search for the name.

Returns

boolean – True if it is a valid name, false otherwise.

Signature

public static boolean isValidName ( $name, $strict = false )

isValidValue()

Checks to see if the given value is valid in the enum.

View source

Arguments

  • $value – The value to search for.
  • $strict (boolean) – Defaults to false. If set the true, will do a case sensitive search for the value.

Returns

boolean – True if it is a valid value, false otherwise.

Signature

public static boolean isValidValue ( $value, $strict = false )