You are here

public function Enum::__construct 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::__construct()

Creates a new value of some type

Parameters

mixed $value:

Throws

\UnexpectedValueException if incompatible type is given.

File

sqlsrv/enum.inc, line 29

Class

Enum
Base Enum class

Code

public function __construct($value) {
  if (!$this
    ->isValid($value)) {
    throw new \UnexpectedValueException("Value '{$value}' is not part of the enum " . get_called_class());
  }
  $this->value = $value;
}