PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.22
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.22
1.10.24 1.10.23 1.10.22 1.10.21 1.10.20 1.10.19 1.10.18 1.10.17 1.10.16 1.10.15 1.10.13 1.10.14 1.10.12 1.10.11 1.10.10 1.10.9 1.10.8 untagged-3d9b7ccddc54df87c672 1.10.7 1.10.6 1.10.5 1.10.3 1.10.4 1.10.2 1.10.1 All 168 releases
woocommerce-pos / vendor_prefixed / sentry / sentry / src / Serializer / EnvelopItems / CheckInItem.php

CheckInItem.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.22, at vendor_prefixed/sentry/sentry/src/Serializer/EnvelopItems/CheckInItem.php

30 lines 1.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 declare (strict_types=1);
4 namespace WCPOS\Vendor\Sentry\Serializer\EnvelopItems;
5
6 use WCPOS\Vendor\Sentry\Event;
7 use WCPOS\Vendor\Sentry\Util\JSON;
8 /**
9 * @internal
10 */
11 class CheckInItem implements EnvelopeItemInterface
12 {
13 public static function toEnvelopeItem(Event $event) : string
14 {
15 $header = ['type' => (string) $event->getType(), 'content_type' => 'application/json'];
16 $payload = [];
17 $checkIn = $event->getCheckIn();
18 if ($checkIn !== null) {
19 $payload = ['check_in_id' => $checkIn->getId(), 'monitor_slug' => $checkIn->getMonitorSlug(), 'status' => (string) $checkIn->getStatus(), 'duration' => $checkIn->getDuration(), 'release' => $checkIn->getRelease(), 'environment' => $checkIn->getEnvironment()];
20 if ($checkIn->getMonitorConfig() !== null) {
21 $payload['monitor_config'] = $checkIn->getMonitorConfig()->toArray();
22 }
23 if (!empty($event->getContexts()['trace'])) {
24 $payload['contexts']['trace'] = $event->getContexts()['trace'];
25 }
26 }
27 return \sprintf("%s\n%s", JSON::encode($header), JSON::encode($payload));
28 }
29 }
30