|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
/* |
|
4
|
|
|
* This file is part of the Bukashk0zzzYmlGenerator |
|
5
|
|
|
* |
|
6
|
|
|
* (c) Denis Golubovskiy <[email protected]> |
|
7
|
|
|
* |
|
8
|
|
|
* For the full copyright and license information, please view the LICENSE |
|
9
|
|
|
* file that was distributed with this source code. |
|
10
|
|
|
*/ |
|
11
|
|
|
|
|
12
|
|
|
namespace Bukashk0zzz\YmlGenerator\Model\Offer; |
|
13
|
|
|
|
|
14
|
|
|
/** |
|
15
|
|
|
* Class OfferCustom |
|
16
|
|
|
* |
|
17
|
|
|
* @author Denis Golubovskiy <[email protected]> |
|
18
|
|
|
*/ |
|
19
|
|
|
class OfferCustom extends AbstractOffer |
|
20
|
|
|
{ |
|
21
|
|
|
/** |
|
22
|
|
|
* @var string |
|
23
|
|
|
*/ |
|
24
|
|
|
private $typePrefix; |
|
25
|
|
|
|
|
26
|
|
|
/** |
|
27
|
|
|
* @var string |
|
28
|
|
|
*/ |
|
29
|
|
|
private $vendor; |
|
30
|
|
|
|
|
31
|
|
|
/** |
|
32
|
|
|
* @var string |
|
33
|
|
|
*/ |
|
34
|
|
|
private $vendorCode; |
|
35
|
|
|
|
|
36
|
|
|
/** |
|
37
|
|
|
* @var string |
|
38
|
|
|
*/ |
|
39
|
|
|
private $model; |
|
40
|
|
|
|
|
41
|
|
|
/** |
|
42
|
|
|
* @return array |
|
43
|
|
|
*/ |
|
44
|
|
View Code Duplication |
public function toArray() |
|
|
|
|
|
|
45
|
|
|
{ |
|
46
|
|
|
return array_merge($this->getHeaderOptions(), [ |
|
47
|
|
|
'typePrefix' => $this->getTypePrefix(), |
|
48
|
|
|
'vendor' => $this->getVendor(), |
|
49
|
|
|
'vendorCode' => $this->getVendorCode(), |
|
50
|
|
|
'model' => $this->getModel(), |
|
51
|
|
|
], $this->getFooterOptions()); |
|
52
|
|
|
} |
|
53
|
|
|
|
|
54
|
|
|
/** |
|
55
|
|
|
* @return string |
|
56
|
|
|
*/ |
|
57
|
|
|
public function getType() |
|
58
|
|
|
{ |
|
59
|
|
|
return 'vendor.model'; |
|
60
|
|
|
} |
|
61
|
|
|
|
|
62
|
|
|
/** |
|
63
|
|
|
* @return string |
|
64
|
|
|
*/ |
|
65
|
|
|
public function getTypePrefix() |
|
66
|
|
|
{ |
|
67
|
|
|
return $this->typePrefix; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
|
|
/** |
|
71
|
|
|
* @param string $typePrefix |
|
72
|
|
|
* @return $this |
|
73
|
|
|
*/ |
|
74
|
|
|
public function setTypePrefix($typePrefix) |
|
75
|
|
|
{ |
|
76
|
|
|
$this->typePrefix = $typePrefix; |
|
77
|
|
|
|
|
78
|
|
|
return $this; |
|
79
|
|
|
} |
|
80
|
|
|
|
|
81
|
|
|
/** |
|
82
|
|
|
* @return string |
|
83
|
|
|
*/ |
|
84
|
|
|
public function getModel() |
|
85
|
|
|
{ |
|
86
|
|
|
return $this->model; |
|
87
|
|
|
} |
|
88
|
|
|
|
|
89
|
|
|
/** |
|
90
|
|
|
* @param string $model |
|
91
|
|
|
* @return $this |
|
92
|
|
|
*/ |
|
93
|
|
|
public function setModel($model) |
|
94
|
|
|
{ |
|
95
|
|
|
$this->model = $model; |
|
96
|
|
|
|
|
97
|
|
|
return $this; |
|
98
|
|
|
} |
|
99
|
|
|
|
|
100
|
|
|
/** |
|
101
|
|
|
* @return string |
|
102
|
|
|
*/ |
|
103
|
|
|
public function getVendor() |
|
104
|
|
|
{ |
|
105
|
|
|
return $this->vendor; |
|
106
|
|
|
} |
|
107
|
|
|
|
|
108
|
|
|
/** |
|
109
|
|
|
* @param string $vendor |
|
110
|
|
|
* @return $this |
|
111
|
|
|
*/ |
|
112
|
|
|
public function setVendor($vendor) |
|
113
|
|
|
{ |
|
114
|
|
|
$this->vendor = $vendor; |
|
115
|
|
|
|
|
116
|
|
|
return $this; |
|
117
|
|
|
} |
|
118
|
|
|
|
|
119
|
|
|
/** |
|
120
|
|
|
* @return string |
|
121
|
|
|
*/ |
|
122
|
|
|
public function getVendorCode() |
|
123
|
|
|
{ |
|
124
|
|
|
return $this->vendorCode; |
|
125
|
|
|
} |
|
126
|
|
|
|
|
127
|
|
|
/** |
|
128
|
|
|
* @param string $vendorCode |
|
129
|
|
|
* @return $this |
|
130
|
|
|
*/ |
|
131
|
|
|
public function setVendorCode($vendorCode) |
|
132
|
|
|
{ |
|
133
|
|
|
$this->vendorCode = $vendorCode; |
|
134
|
|
|
|
|
135
|
|
|
return $this; |
|
136
|
|
|
} |
|
137
|
|
|
} |
|
138
|
|
|
|
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.