| Conditions | 3 |
| Paths | 4 |
| Total Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 8 |
| CRAP Score | 3 |
| Changes | 0 | ||
| 1 | <?php |
||
| 43 | 2 | public function insert(string $table, array $data, array $headers) |
|
| 44 | { |
||
| 45 | 2 | if (count($data) < $this->bucketSize) { |
|
| 46 | 2 | $buckets = [$data]; |
|
| 47 | } else { |
||
| 48 | 1 | $buckets = array_chunk($data, $this->bucketSize); |
|
| 49 | } |
||
| 50 | |||
| 51 | 2 | $client = $this->get(Client::class); |
|
| 52 | 2 | foreach ($buckets as $bucket) { |
|
| 53 | 2 | $client->insert($table, $bucket, $headers); |
|
| 54 | } |
||
| 55 | |||
| 56 | 2 | return count($buckets); |
|
| 57 | } |
||
| 58 | } |
||
| 59 |