@@ -28,10 +28,10 @@ public function __construct(
28
28
}
29
29
30
30
/**
31
- * @param string[] $inAppInclude
32
- * @param string[] $inAppExclude
33
- * @param string[] $prefixes
34
- * @param mixed[] $tags
31
+ * @param string[] $inAppInclude
32
+ * @param string[] $inAppExclude
33
+ * @param string[] $prefixes
34
+ * @param array<string, mixed> $tags
35
35
*/
36
36
public function create (
37
37
string |null $ dsn ,
@@ -42,21 +42,45 @@ public function create(
42
42
array |null $ prefixes = null ,
43
43
array |null $ tags = null ,
44
44
): HubInterface {
45
- $ clientBuilder = ClientBuilder::create ([
46
- 'dsn ' => $ dsn ?: null ,
47
- 'environment ' => $ environment , // I.e.: staging, testing, production, etc.
48
- 'in_app_include ' => $ inAppInclude ?? [],
49
- 'in_app_exclude ' => $ inAppExclude ?? [],
50
- 'prefixes ' => $ prefixes ?? [],
51
- 'release ' => $ release ,
52
- 'attach_stacktrace ' => false ,
53
- 'default_integrations ' => false ,
54
- 'integrations ' => [
55
- new RequestIntegration (),
56
- new EnvironmentIntegration (),
57
- new FrameContextifierIntegration ($ this ->logger ),
45
+ return $ this ->createFromArray (
46
+ [
47
+ 'dsn ' => $ dsn ?: null ,
48
+ 'environment ' => $ environment , // I.e.: staging, testing, production, etc.
49
+ 'in_app_include ' => $ inAppInclude ?? [],
50
+ 'in_app_exclude ' => $ inAppExclude ?? [],
51
+ 'prefixes ' => $ prefixes ?? [],
52
+ 'release ' => $ release ,
53
+ 'attach_stacktrace ' => false ,
54
+ 'default_integrations ' => false ,
55
+ 'integrations ' => [
56
+ new RequestIntegration (),
57
+ new EnvironmentIntegration (),
58
+ new FrameContextifierIntegration ($ this ->logger ),
59
+ ],
58
60
],
59
- ]);
61
+ $ tags ,
62
+ );
63
+ }
64
+
65
+ /**
66
+ * @param array<string, mixed> $options
67
+ * @param array<string, mixed> $tags
68
+ */
69
+ public function createFromArray (array $ options , array |null $ tags = null ): HubInterface
70
+ {
71
+ $ options ['dsn ' ] ??= null ;
72
+ $ options ['in_app_include ' ] ??= [];
73
+ $ options ['in_app_exclude ' ] ??= [];
74
+ $ options ['prefixes ' ] ??= [];
75
+ $ options ['attach_stacktrace ' ] ??= false ;
76
+ $ options ['default_integrations ' ] ??= false ;
77
+ $ options ['integrations ' ] ??= [
78
+ new RequestIntegration (),
79
+ new EnvironmentIntegration (),
80
+ new FrameContextifierIntegration ($ this ->logger ),
81
+ ];
82
+
83
+ $ clientBuilder = ClientBuilder::create ($ options );
60
84
61
85
$ clientBuilder ->setLogger ($ this ->logger );
62
86
0 commit comments