Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class GenericEncoder
- {
- private function prepareData($data, string $format)
- {
- switch ($format) {
- case 'json':
- $data = $this->forceArray($data);
- $data = $this->fixKeys($data);
- // fall through
- case 'xml':
- $data = $this->fixAttributes($data);
- break;
- default:
- throw new InvalidArgumentException(
- 'Format not supported'
- );
- }
- return $data;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement