| Conditions | 3 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 17 |
| CRAP Score | 3 |
| Changes | 1 | ||
| Bugs | 0 | Features | 0 |
| 1 | <?php |
||
| 21 | 1 | protected function save(array $items) |
|
| 22 | { |
||
| 23 | 1 | $creating = []; |
|
| 24 | |||
| 25 | 1 | foreach($items as $item) { |
|
| 26 | 1 | $creating[] = $item->toArray(); |
|
| 27 | } |
||
| 28 | |||
| 29 | 1 | $creatingJobs = []; |
|
| 30 | 1 | foreach(array_chunk($creating, 50) as $data) { |
|
| 31 | 1 | $creatingJobs[] = new CreateRecords( |
|
| 32 | 1 | $data, |
|
| 33 | 1 | $this->config('apiKey'), |
|
| 34 | 1 | $this->config('baseId'), |
|
| 35 | 1 | $this->config('tableName') |
|
| 36 | ); |
||
| 37 | } |
||
| 38 | |||
| 39 | 1 | dispatch( |
|
| 40 | 1 | new FlushRows( |
|
| 41 | 1 | $this->config('apiKey'), |
|
| 42 | 1 | $this->config('baseId'), |
|
| 43 | 1 | $this->config('tableName') |
|
| 44 | ) |
||
| 45 | 1 | )->chain($creatingJobs); |
|
| 46 | } |
||
| 47 | } |