1 | <?php |
||
20 | class Export |
||
21 | { |
||
22 | |||
23 | /** |
||
24 | * Product model instance |
||
25 | * @var \gplcart\core\models\Product $product |
||
26 | */ |
||
27 | protected $product; |
||
28 | |||
29 | /** |
||
30 | * Price model instance |
||
31 | * @var \gplcart\core\models\Price $price |
||
32 | */ |
||
33 | protected $price; |
||
34 | |||
35 | /** |
||
36 | * File model instance |
||
37 | * @var \gplcart\core\models\File $file |
||
38 | */ |
||
39 | protected $file; |
||
40 | |||
41 | /** |
||
42 | * Store model instance |
||
43 | * @var \gplcart\core\models\Store $store |
||
44 | */ |
||
45 | protected $store; |
||
46 | |||
47 | /** |
||
48 | * An array of the current job data |
||
49 | * @var array |
||
50 | */ |
||
51 | protected $job = array(); |
||
52 | |||
53 | /** |
||
54 | * Export constructor. |
||
55 | * @param Product $product |
||
56 | * @param Price $price |
||
57 | * @param File $file |
||
58 | * @param Store $store |
||
59 | */ |
||
60 | public function __construct(Product $product, Price $price, File $file, Store $store) |
||
61 | { |
||
62 | $this->file = $file; |
||
63 | $this->price = $price; |
||
64 | $this->store = $store; |
||
65 | $this->product = $product; |
||
66 | } |
||
67 | |||
68 | /** |
||
69 | * Processes one job iteration |
||
70 | * @param array $job |
||
71 | */ |
||
72 | public function process(array &$job) |
||
93 | |||
94 | /** |
||
95 | * Prepares export data |
||
96 | * @param array $product |
||
97 | * @return array |
||
98 | */ |
||
99 | protected function prepare(array $product) |
||
112 | |||
113 | /** |
||
114 | * Prepares prices |
||
115 | * @param array $data |
||
116 | * @param array $product |
||
117 | */ |
||
118 | protected function preparePrice(array &$data, array $product) |
||
124 | |||
125 | /** |
||
126 | * Prepares images |
||
127 | * @param array $data |
||
128 | * @param array $product |
||
129 | * @return null|array |
||
130 | */ |
||
131 | protected function prepareImages(array &$data, array $product) |
||
159 | |||
160 | /** |
||
161 | * Returns an array of product images |
||
162 | * @param array $product |
||
163 | * @return array |
||
164 | */ |
||
165 | protected function getImages(array $product) |
||
177 | |||
178 | } |
||
179 |