public function convertFormatted2array($type = '', $data = '') { $resultArray = ''; if ($type == 'json') { $resultArray = json_decode($data, true); } if ($type == 'yaml') { $resultArray = Spyc::YAMLLoad($data); } return $resultArray; }