Conditions | 2 |
Paths | 2 |
Total Lines | 15 |
Code Lines | 9 |
Lines | 0 |
Ratio | 0 % |
Changes | 1 | ||
Bugs | 0 | Features | 0 |
1 | <?php |
||
32 | public function validateItem(array $values): array |
||
33 | { |
||
34 | $validator = Validator::make($this->values($values), [ |
||
35 | 'global' => 'required|boolean', |
||
36 | 'amount' => 'required|regex:/^\d+(\.\d{1,2})?$/', |
||
37 | 'deadline' => 'required|integer|min:1', |
||
38 | ]); |
||
39 | if($validator->fails()) |
||
40 | { |
||
41 | throw new ValidationException($validator); |
||
42 | } |
||
43 | |||
44 | $validated = $validator->validated(); |
||
45 | $validated['amount'] = $this->localeService->convertMoneyToInt((float)$validated['amount']); |
||
46 | return $validated; |
||
47 | } |
||
49 |