You are here

public static function Enum::toArray in Drupal driver for SQL Server and SQL Azure 7.2

Same name and namespace in other branches
  1. 7.3 sqlsrv/enum.inc \Enum::toArray()

Returns all possible values as an array

Return value

array Constant name in key, constant value in value

5 calls to Enum::toArray()
Enum::isValid in sqlsrv/enum.inc
Check if is valid enum value
Enum::isValidKey in sqlsrv/enum.inc
Check if is valid enum key
Enum::keys in sqlsrv/enum.inc
Returns the names (keys) of all constants in the Enum class
Enum::search in sqlsrv/enum.inc
Return key for value
Enum::values in sqlsrv/enum.inc
Returns instances of the Enum class of all Enum constants

File

sqlsrv/enum.inc, line 86

Class

Enum
Base Enum class

Code

public static function toArray() {
  $class = get_called_class();
  if (!array_key_exists($class, self::$cache)) {
    $reflection = new \ReflectionClass($class);
    self::$cache[$class] = $reflection
      ->getConstants();
  }
  return self::$cache[$class];
}