PluginProbe
WCPOS – Point of Sale (POS) plugin for WooCommerce / 1.10.17
WCPOS – Point of Sale (POS) plugin for WooCommerce v1.10.17
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 1.10.4 1.10.2 All 169 releases
← All changes | vendor_prefixed/sentry/sentry/src/SentrySdk.php +9 -49 1.10.24 → 1.10.17 View file →
@@ -8,9 +8,8 @@
8 8 use WCPOS\Vendor\Sentry\State\Hub;
9 9 use WCPOS\Vendor\Sentry\State\HubInterface;
10 10 use WCPOS\Vendor\Sentry\State\RuntimeContext;
11 11 use WCPOS\Vendor\Sentry\State\RuntimeContextManager;
12 -use WCPOS\Vendor\Sentry\State\RuntimeContextStorageInterface;
13 12 /**
14 13 * This class is the main entry point for all the most common SDK features.
15 14 *
16 15 * @author Stefano Arlandini <[email protected]>
@@ -25,12 +24,8 @@
25 24 * @var RuntimeContextManager|null
26 25 */
27 26 private static $runtimeContextManager;
28 27 /**
29 - * @var RuntimeContextStorageInterface|null
30 - */
31 - private static $runtimeContextStorage;
32 - /**
33 28 * Constructor.
34 29 */
35 30 private function __construct()
36 31 {
@@ -40,32 +35,13 @@
40 35 * gets called.
41 36 */
42 37 public static function init() : HubInterface
43 38 {
44 - if (self::$runtimeContextManager !== null) {
45 - self::$runtimeContextManager->discardActiveContext();
46 - }
47 39 self::$currentHub = new Hub();
48 - self::$runtimeContextManager = null;
40 + self::$runtimeContextManager = new RuntimeContextManager(self::$currentHub);
49 41 return self::getCurrentHub();
50 42 }
51 43 /**
52 - * Registers storage for isolating runtime contexts across overlapping logical executions.
53 - *
54 - * The registration persists across SDK initialization. Changing it discards the active
55 - * context for the current logical execution without flushing it. Concurrent runtimes
56 - * should register storage before logical executions begin and must not replace it while
57 - * other logical executions are active.
58 - */
59 - public static function setRuntimeContextStorage(?RuntimeContextStorageInterface $runtimeContextStorage) : void
60 - {
61 - if (self::$runtimeContextManager !== null) {
62 - self::$runtimeContextManager->discardActiveContext();
63 - }
64 - self::$runtimeContextStorage = $runtimeContextStorage;
65 - self::$runtimeContextManager = null;
66 - }
67 - /**
68 44 * Gets the current hub. If it's not initialized then creates a new instance
69 45 * and sets it as current hub.
70 46 */
71 47 public static function getCurrentHub() : HubInterface
@@ -88,31 +64,12 @@
88 64 self::$currentHub = $hub;
89 65 }
90 66 return $hub;
91 67 }
92 - /**
93 - * Starts an isolated context for the current logical execution.
94 - *
95 - * A provided hub is used as-is, allowing runtimes with their own HubInterface
96 - * implementation to manage hub isolation. When no hub is provided, the SDK
97 - * creates an isolated hub from the baseline.
98 - *
99 - * If a context is already active, this method is a no-op and the provided hub
100 - * is ignored. Use setCurrentHub() to replace the active context's hub.
101 - *
102 - * @param HubInterface|null $hub The hub to use for the new context
103 - */
104 - public static function startContext(?HubInterface $hub = null) : void
68 + public static function startContext() : void
105 69 {
106 - self::getRuntimeContextManager()->startContext($hub);
70 + self::getRuntimeContextManager()->startContext();
107 71 }
108 - /**
109 - * Ends and flushes the active context for the current logical execution.
110 - *
111 - * When no context is active this is a no-op.
112 - *
113 - * @param int|null $timeout The maximum number of seconds to wait while flushing the client transport
114 - */
115 72 public static function endContext(?int $timeout = null) : void
116 73 {
117 74 self::getRuntimeContextManager()->endContext($timeout);
118 75 }
@@ -118,9 +75,9 @@
118 75 }
119 76 /**
120 77 * Executes the given callback within an isolated context.
121 78 *
122 - * If a context is already active for the current logical execution, this method
79 + * If a context is already active for the current execution key, this method
123 80 * reuses it and only executes the callback.
124 81 *
125 82 * @param callable $callback The callback to execute
126 83 *
@@ -134,9 +91,12 @@
134 91 */
135 92 public static function withContext(callable $callback, ?int $timeout = null)
136 93 {
137 94 $runtimeContextManager = self::getRuntimeContextManager();
138 - $startedNewContext = $runtimeContextManager->startContext();
95 + $startedNewContext = !$runtimeContextManager->hasActiveContext();
96 + if ($startedNewContext) {
97 + $runtimeContextManager->startContext();
98 + }
139 99 try {
140 100 return $callback();
141 101 } finally {
142 102 if ($startedNewContext) {
@@ -177,9 +137,9 @@
177 137 if (self::$currentHub === null) {
178 138 self::$currentHub = new Hub();
179 139 }
180 140 if (self::$runtimeContextManager === null) {
181 - self::$runtimeContextManager = new RuntimeContextManager(self::$currentHub, self::$runtimeContextStorage);
141 + self::$runtimeContextManager = new RuntimeContextManager(self::$currentHub);
182 142 }
183 143 return self::$runtimeContextManager;
184 144 }
185 145 }