/** * @param int $id The type ID * @return TIVarType * @throws \Exception */ public static function createFromID($id = -1) { if (TIVarTypes::isValidID($id)) { $instance = new self(); $instance->id = $id; $instance->exts = TIVarTypes::getExtensionsFromTypeID($id); $instance->name = TIVarTypes::getNameFromID($id); $instance->typeHandler = self::determineTypeHandler($id); return $instance; } else { throw new \RuntimeException('Invalid type ID'); } }