Feature issue MDL-47641 to get/set config as array

MDL-47641. It will very helpful for Moodle developers! The point is about autodetect input data for array: if serialized string - unserialize to array, if array - serialize to string. Some help functions are taken from WordPress core.