public static function CRM_Utils_Type::typeToString in CiviCRM Entity 8.3
Gets the string representation for a data type.
Parameters
int $type: Integer number identifying the data type.
Return value
string String identifying the data type, e.g. 'Int' or 'String'.
1 call to CRM_Utils_Type::typeToString()
- CRM_Utils_Type::getDataTypeFromFieldMetadata in tests/
src/ Type.php - Get the data_type for the field.
File
- tests/
src/ Type.php, line 80
Class
- CRM_Utils_Type
- @package CRM @copyright CiviCRM LLC (c) 2004-2017
Code
public static function typeToString($type) {
// @todo Use constants in the case statements, e.g. "case T_INT:".
// @todo return directly, instead of assigning a value.
// @todo Use a lookup array, as a property or as a local variable.
switch ($type) {
case 1:
$string = 'Int';
break;
case 2:
$string = 'String';
break;
case 3:
$string = 'Enum';
break;
case 4:
$string = 'Date';
break;
case 8:
$string = 'Time';
break;
case 16:
$string = 'Boolean';
break;
case 32:
$string = 'Text';
break;
case 64:
$string = 'Blob';
break;
// CRM-10404
case 12:
case 256:
$string = 'Timestamp';
break;
case 512:
$string = 'Float';
break;
case 1024:
$string = 'Money';
break;
case 2048:
$string = 'Date';
break;
case 4096:
$string = 'Email';
break;
case 16384:
$string = 'Mediumblob';
break;
}
return isset($string) ? $string : "";
}