| Conditions | 4 |
| Paths | 4 |
| Total Lines | 25 |
| Code Lines | 13 |
| Lines | 0 |
| Ratio | 0 % |
| Tests | 12 |
| CRAP Score | 4 |
| Changes | 0 | ||
| 1 | <?php |
||
| 55 | 1 | public function batchStore(array $events) |
|
| 56 | { |
||
| 57 | 1 | $data = []; |
|
| 58 | 1 | foreach ($events as $event) { |
|
| 59 | 1 | if (is_array($event)) { |
|
| 60 | 1 | $data[] = $event; |
|
| 61 | 1 | } elseif ($event instanceof Event) { |
|
| 62 | 1 | $data[] = $event->jsonSerialize(); |
|
| 63 | } |
||
| 64 | } |
||
| 65 | |||
| 66 | $postData = [ |
||
| 67 | 'batches' => [ |
||
| 68 | [ |
||
| 69 | 1 | 'events' => $data, |
|
| 70 | ], |
||
| 71 | ], |
||
| 72 | ]; |
||
| 73 | |||
| 74 | 1 | $response = $this->sendPost( |
|
| 75 | 1 | ':account_id:/events/batches', |
|
| 76 | 1 | $postData |
|
| 77 | ); |
||
| 78 | |||
| 79 | 1 | return $response->isSuccess(); |
|
| 80 | } |
||
| 82 |