1 | <?php |
||
14 | abstract class Transformer implements TransformerInterface |
||
15 | { |
||
16 | /** |
||
17 | * Contains collection for transform. |
||
18 | * |
||
19 | * @var Collection |
||
20 | */ |
||
21 | protected $collection; |
||
22 | |||
23 | /** |
||
24 | * Create new transformer instance with given collection of items. |
||
25 | * |
||
26 | * @param Collection $collection |
||
27 | */ |
||
28 | 22 | public function __construct(Collection $collection) |
|
32 | |||
33 | /** |
||
34 | * Transform given item. |
||
35 | * |
||
36 | * @param mixed $item |
||
37 | * |
||
38 | * @return mixed |
||
39 | */ |
||
40 | abstract public function transform($item); |
||
41 | |||
42 | /** |
||
43 | * Execute transform on each collection element given in contructor. |
||
44 | * |
||
45 | * @return Collection |
||
46 | */ |
||
47 | public function execute() |
||
53 | } |
||
54 |