Standardize integer casting

Casting via (integer) is a microoptimization over intval(), but has a
place here.

I'm basing this on results from tests others have done such as
http://hakre.wordpress.com/2010/05/13/php-casting-vs-intval/
Add JSON encoding options

This is simultaneously to support Pretty JSON but also to support other
options a user may wish to use.
Move value setters to separate methods

This facilitates the Value Set collection.
Add value set collection

A collection which ensures only unique values.