Implement Convert class, move existing type conversion functionality there

Fixes #3580
Allow T_STRING for dictionary keys.

Fixes #3581
Implement downtimes.

Fixes #2833