Created
June 11, 2014 11:10
-
-
Save jellyninjadev/98a47784c7bba5e2ca2c to your computer and use it in GitHub Desktop.
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
<?php namespace Bardell\Transformers; | |
abstract class Transformer { | |
public function transformCollection(array $items) { | |
return array_map([$this, 'transform'], $items); | |
} | |
public abstract function transform($item); | |
} |
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
<?php namespace Bardell\Transformers; | |
class WordCardTransformer extends Transformer { | |
public function transform($wordcard) { | |
return [ | |
'word' => $wordcard['word'], | |
'answer' => $wordcard['answer'], | |
'id' => $wordcard['id'] | |
]; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment