Conditions | 5 |
Paths | 6 |
Total Lines | 19 |
Code Lines | 10 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | protected function extended($item) |
||
33 | { |
||
34 | if (array_key_exists('sale_price', $item) && !empty($item['sale_price'])) { |
||
35 | $item['sale_price_discount'] = $item['price'] - $item['sale_price']; |
||
36 | $item['sale_price_percentage'] = ($item['price'] - $item['sale_price']) / $item['price'] * 100; |
||
37 | } |
||
38 | |||
39 | $parts = []; |
||
40 | |||
41 | foreach (['title', 'color', 'size', 'id', 'brand', 'channel', 'category', 'sku'] as $key) { |
||
42 | if (array_key_exists($key, $item)) { |
||
43 | $parts[] = $item[$key]; |
||
44 | } |
||
45 | } |
||
46 | |||
47 | $item['document_slug'] = $this->getNormalizer()->slugify(implode('-', $parts)); |
||
48 | |||
49 | return $item; |
||
50 | } |
||
51 | } |
||
52 |