Conditions | 1 |
Paths | 1 |
Total Lines | 20 |
Code Lines | 14 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
21 | public function extractType(array $input): array |
||
22 | { |
||
23 | $result = [ |
||
24 | 'single' => (function () use ($input) { |
||
25 | $result['rule'] = json_encode(['date' => $input['date']]); |
||
|
|||
26 | $result['period'] = $input['period']; |
||
27 | return $result; |
||
28 | }), |
||
29 | 'period' => (function () use ($input) { |
||
30 | $result['rule'] = json_encode(['from' => $input['disableFrom'], 'to' => $input['disableTo']]); |
||
31 | $result['period'] = $input['period']; |
||
32 | return $result; |
||
33 | }), |
||
34 | 'recurrent_day' => (function () use ($input) { |
||
35 | $result['rule'] = json_encode(['dayOfWeek' => $input['dayOfWeek']]); |
||
36 | $result['period'] = $input['period']; |
||
37 | return $result; |
||
38 | }) |
||
39 | ]; |
||
40 | return $result[$input['period']](); |
||
41 | } |
||
43 |