-
Notifications
You must be signed in to change notification settings - Fork 50
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DataTransformerFactory + tidy up
- Loading branch information
Marc Littlemore
committed
Jul 20, 2017
1 parent
235bfc1
commit cd432d2
Showing
2 changed files
with
55 additions
and
56 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<?php | ||
|
||
namespace MarcL\Transformers; | ||
|
||
class DataTransformerFactory { | ||
static public function create($outputType) { | ||
switch($outputType) { | ||
case 'array': | ||
return new ArrayTransformer(); | ||
break; | ||
case 'json': | ||
return new JsonTransformer(); | ||
break; | ||
case 'simple': | ||
return new SimpleArrayTransformer(); | ||
break; | ||
case 'xml': | ||
default: | ||
return new XmlTransformer(); | ||
break; | ||
} | ||
} | ||
} | ||
|
||
?> |