public function __construct($elements = array()) { parent::__construct($elements); foreach ($this as $key => $value) { $this[$key] = static::convertToType($value); } }