File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -82,6 +82,20 @@ public function __construct($sdkKey, $options = array()) {
8282
8383 $ this ->_eventProcessor = new EventProcessor ($ sdkKey , $ options );
8484
85+ $ this ->_featureRequester = $ this ->getFeatureRequester ($ options , $ sdkKey );
86+ }
87+
88+ /**
89+ * @param mixed[] $options
90+ * @param string $sdkKey
91+ * @return FeatureRequester
92+ */
93+ private function getFeatureRequester (array $ options , $ sdkKey )
94+ {
95+ if (isset ($ options ['feature_requester ' ]) && $ options ['feature_requester ' ] instanceof FeatureRequester) {
96+ return $ options ['feature_requester ' ];
97+ }
98+
8599 if (isset ($ options ['feature_requester_class ' ])) {
86100 $ featureRequesterClass = $ options ['feature_requester_class ' ];
87101 } else {
@@ -91,7 +105,7 @@ public function __construct($sdkKey, $options = array()) {
91105 if (!is_a ($ featureRequesterClass , FeatureRequester::class, true )) {
92106 throw new \InvalidArgumentException ;
93107 }
94- $ this -> _featureRequester = new $ featureRequesterClass ($ this ->_baseUri , $ sdkKey , $ options );
108+ return new $ featureRequesterClass ($ this ->_baseUri , $ sdkKey , $ options );
95109 }
96110
97111 /**
You can’t perform that action at this time.
0 commit comments