PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.27
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.27
1.10.27 1.10.26 1.10.25 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 All 171 releases
woocommerce-pos / vendor_prefixed / sentry / sentry / src / Integration / TransactionIntegration.php

TransactionIntegration.php in WCPOS – Point of Sale (POS) plugin for WooCommerce 1.10.27, at vendor_prefixed/sentry/sentry/src/Integration/TransactionIntegration.php

43 lines 1.4 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\Integration;
5
6 use WCPOS\Vendor\Sentry\Event;
7 use WCPOS\Vendor\Sentry\EventHint;
8 use WCPOS\Vendor\Sentry\SentrySdk;
9 use WCPOS\Vendor\Sentry\State\Scope;
10 /**
11 * This integration sets the `transaction` attribute of the event to the value
12 * found in the raw event payload or to the value of the `PATH_INFO` server var
13 * if present.
14 *
15 * @author Stefano Arlandini <[email protected]>
16 */
17 final class TransactionIntegration implements IntegrationInterface
18 {
19 /**
20 * {@inheritdoc}
21 */
22 public function setupOnce() : void
23 {
24 Scope::addGlobalEventProcessor(static function (Event $event, EventHint $hint) : Event {
25 $integration = SentrySdk::getCurrentHub()->getIntegration(self::class);
26 // The client bound to the current hub, if any, could not have this
27 // integration enabled. If this is the case, bail out
28 if ($integration === null) {
29 return $event;
30 }
31 if ($event->getTransaction() !== null) {
32 return $event;
33 }
34 if (isset($hint->extra['transaction']) && \is_string($hint->extra['transaction'])) {
35 $event->setTransaction($hint->extra['transaction']);
36 } elseif (isset($_SERVER['PATH_INFO'])) {
37 $event->setTransaction($_SERVER['PATH_INFO']);
38 }
39 return $event;
40 });
41 }
42 }
43