| Conditions | 6 |
| Paths | 5 |
| Total Lines | 19 |
| Code Lines | 14 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 0 |
| CRAP Score | 42 |
| Changes | 0 | ||
| 1 | <?php |
||
| 18 | public function handle() |
||
| 19 | { |
||
| 20 | $response = IproSoftwareFacade::getBookingRulesList()->onlySuccessful(); |
||
| 21 | |||
| 22 | $groups = $response->json(); |
||
| 23 | if (is_array($groups) && !empty($groups)) { |
||
| 24 | foreach ($groups as $groupType => $items) { |
||
| 25 | foreach ($items as $item) { |
||
| 26 | if (!isset($item['Id'])) { |
||
| 27 | continue; |
||
| 28 | } |
||
| 29 | BookingRule::firstOrNew(['id' => $item['Id']], ) |
||
| 30 | ->fill([ |
||
| 31 | 'name' => $item['Name'], |
||
| 32 | 'type' => $groupType, |
||
| 33 | 'rules' => Arr::except($item, ['Id', 'Name']), |
||
| 34 | ]) |
||
| 35 | ->fillPulled() |
||
| 36 | ->save(); |
||
| 37 | } |
||
| 42 |