@@ -28,10 +28,10 @@ public function __construct(
2828 }
2929
3030 /**
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
3535 */
3636 public function create (
3737 string |null $ dsn ,
@@ -42,21 +42,45 @@ public function create(
4242 array |null $ prefixes = null ,
4343 array |null $ tags = null ,
4444 ): 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+ ],
5860 ],
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 );
6084
6185 $ clientBuilder ->setLogger ($ this ->logger );
6286
0 commit comments