public final function getOrdinal()
{
if ($this->ordinal !== null) {
return $this->ordinal;
}
// detect ordinal
$ordinal = 0;
$value = $this->value;
foreach (self::detectConstants(get_called_class()) as $constValue) {
if ($value === $constValue) {
break;
}
++$ordinal;
}
$this->ordinal = $ordinal;
return $ordinal;
}