This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Speicher210\Fastbill\Api\Model; |
||
4 | |||
5 | use JMS\Serializer\Annotation as JMS; |
||
6 | |||
7 | /** |
||
8 | * Addon model. |
||
9 | */ |
||
10 | class Addon |
||
11 | { |
||
12 | /** |
||
13 | * The article number. |
||
14 | * |
||
15 | * @var string |
||
16 | * |
||
17 | * @JMS\Type("string") |
||
18 | * @JMS\SerializedName("ARTICLE_NUMBER") |
||
19 | */ |
||
20 | protected $articleNumber; |
||
21 | |||
22 | /** |
||
23 | * Quantity. |
||
24 | * |
||
25 | * @var integer |
||
26 | * |
||
27 | * @JMS\Type("integer") |
||
28 | * @JMS\SerializedName("QUANTITY") |
||
29 | */ |
||
30 | protected $quantity; |
||
31 | |||
32 | /** |
||
33 | * The title of the addon. |
||
34 | * |
||
35 | * @var string |
||
36 | * |
||
37 | * @JMS\Type("string") |
||
38 | * @JMS\SerializedName("TITLE") |
||
39 | */ |
||
40 | protected $title; |
||
41 | |||
42 | /** |
||
43 | * The description of the on. |
||
44 | * |
||
45 | * @var string |
||
46 | * |
||
47 | * @JMS\Type("string") |
||
48 | * @JMS\SerializedName("DESCRIPTION") |
||
49 | */ |
||
50 | protected $description; |
||
51 | |||
52 | /** |
||
53 | * The unit price. |
||
54 | * |
||
55 | * @var float |
||
56 | * |
||
57 | * @JMS\Type("float") |
||
58 | * @JMS\SerializedName("UNIT_PRICE") |
||
59 | */ |
||
60 | protected $unitPrice; |
||
61 | |||
62 | /** |
||
63 | * VAT percent. |
||
64 | * |
||
65 | * @var float |
||
66 | * |
||
67 | * @JMS\Type("float") |
||
68 | * @JMS\SerializedName("VAT_PERCENT") |
||
69 | */ |
||
70 | protected $vatPercent; |
||
71 | |||
72 | /** |
||
73 | * Constructor. |
||
74 | * |
||
75 | * @param string $articleNumber The article number. |
||
76 | * @param integer $quantity The quantity. |
||
77 | * @param string $title The title. |
||
78 | * @param string $description The description. |
||
79 | * @param float $unitPrice The price. |
||
80 | * @param float $vatPercent The VAT percentage. |
||
81 | */ |
||
82 | public function __construct($articleNumber, $quantity, $title, $description, $unitPrice, $vatPercent) |
||
83 | { |
||
84 | $this->setArticleNumber($articleNumber); |
||
85 | $this->setQuantity($quantity); |
||
86 | $this->setTitle($title); |
||
87 | $this->setDescription($description); |
||
88 | $this->setUnitPrice($unitPrice); |
||
89 | $this->setVatPercent($vatPercent); |
||
90 | } |
||
91 | |||
92 | /** |
||
93 | * Get the article number. |
||
94 | * |
||
95 | * @return integer |
||
96 | */ |
||
97 | public function getArticleNumber() |
||
98 | { |
||
99 | return $this->articleNumber; |
||
100 | } |
||
101 | |||
102 | /** |
||
103 | * Set the article number. |
||
104 | * |
||
105 | * @param string $articleNumber The article number. |
||
106 | * @return $this |
||
107 | */ |
||
108 | public function setArticleNumber($articleNumber) |
||
109 | { |
||
110 | $this->articleNumber = $articleNumber; |
||
111 | |||
112 | return $this; |
||
113 | } |
||
114 | |||
115 | /** |
||
116 | * Get the quantity. |
||
117 | * |
||
118 | * @return integer |
||
119 | */ |
||
120 | public function getQuantity() |
||
121 | { |
||
122 | return $this->quantity; |
||
123 | } |
||
124 | |||
125 | /** |
||
126 | * Set the quantity. |
||
127 | * |
||
128 | * @param integer $quantity The quantity. |
||
129 | * @return $this |
||
130 | */ |
||
131 | public function setQuantity($quantity) |
||
132 | { |
||
133 | if ($quantity < 1) { |
||
134 | throw new \InvalidArgumentException('Quantity must be bigger than 0.'); |
||
135 | } |
||
136 | $this->quantity = $quantity; |
||
137 | |||
138 | return $this; |
||
139 | } |
||
140 | |||
141 | /** |
||
142 | * Get the title. |
||
143 | * |
||
144 | * @return string |
||
145 | */ |
||
146 | public function getTitle() |
||
147 | { |
||
148 | return $this->title; |
||
149 | } |
||
150 | |||
151 | /** |
||
152 | * Set the title. |
||
153 | * |
||
154 | * @param string $title The title. |
||
155 | * @return $this |
||
156 | */ |
||
157 | public function setTitle($title) |
||
158 | { |
||
159 | $this->title = $title; |
||
160 | |||
161 | return $this; |
||
162 | } |
||
163 | |||
164 | /** |
||
165 | * Get the description. |
||
166 | * |
||
167 | * @return string |
||
168 | */ |
||
169 | public function getDescription() |
||
170 | { |
||
171 | return $this->description; |
||
172 | } |
||
173 | |||
174 | /** |
||
175 | * Set the description. |
||
176 | * |
||
177 | * @param string $description The description. |
||
178 | * @return $this |
||
179 | */ |
||
180 | public function setDescription($description) |
||
181 | { |
||
182 | $this->description = $description; |
||
183 | |||
184 | return $this; |
||
185 | } |
||
186 | |||
187 | /** |
||
188 | * Get the unit price. |
||
189 | * |
||
190 | * @return float |
||
191 | */ |
||
192 | public function getUnitPrice() |
||
193 | { |
||
194 | return $this->unitPrice; |
||
195 | } |
||
196 | |||
197 | /** |
||
198 | * Set the unit price. |
||
199 | * |
||
200 | * @param float $unitPrice The price. |
||
201 | * @return $this |
||
202 | */ |
||
203 | public function setUnitPrice($unitPrice) |
||
204 | { |
||
205 | $this->unitPrice = $unitPrice; |
||
206 | |||
207 | return $this; |
||
208 | } |
||
209 | |||
210 | /** |
||
211 | * Get the VAT percentage. |
||
212 | * |
||
213 | * @return float |
||
214 | */ |
||
215 | public function getVatPercent() |
||
216 | { |
||
217 | return $this->vatPercent; |
||
218 | } |
||
219 | |||
220 | /** |
||
221 | * Set the VAT percentage. |
||
222 | * |
||
223 | * @param float $vatPercent The VAT percentage. |
||
224 | * @return $this |
||
225 | */ |
||
226 | View Code Duplication | public function setVatPercent($vatPercent) |
|
0 ignored issues
–
show
|
|||
227 | { |
||
228 | if ($vatPercent < 0 || $vatPercent > 100) { |
||
229 | throw new \InvalidArgumentException('VAT percentage must be between 0-100'); |
||
230 | } |
||
231 | $this->vatPercent = $vatPercent; |
||
232 | |||
233 | return $this; |
||
234 | } |
||
235 | } |
||
236 |
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.