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