File tree Expand file tree Collapse file tree 2 files changed +15
-8
lines changed
src/SplitIO/Component/Common
tests/Suite/InputValidation Expand file tree Collapse file tree 2 files changed +15
-8
lines changed Original file line number Diff line number Diff line change @@ -71,12 +71,19 @@ public static function trackFactory($apiKey)
7171 $ tracked = 1 ;
7272 if (isset (self ::getInstance ()->factoryTracker [$ apiKey ])) {
7373 $ currentInstances = self ::getInstance ()->factoryTracker [$ apiKey ];
74- self ::getInstance ()->getLogger ()->warning (
75- "Factory Instantiation: You already have " . $ currentInstances .
76- " factory/ies with this API Key. " .
77- "We recommend keeping only one instance of the factory at all times " .
78- "(Singleton pattern) and reusing it throughout your application. "
79- );
74+ if ($ currentInstances == 1 ) {
75+ self ::getInstance ()->getLogger ()->warning (
76+ "Factory Instantiation: You already have 1 factory with this API Key. " .
77+ "We recommend keeping only one instance of the factory at all times " .
78+ "(Singleton pattern) and reusing it throughout your application. "
79+ );
80+ } else {
81+ self ::getInstance ()->getLogger ()->warning (
82+ "Factory Instantiation: You already have " . $ currentInstances . " factories with this API Key. " .
83+ "We recommend keeping only one instance of the factory at all times " .
84+ "(Singleton pattern) and reusing it throughout your application. "
85+ );
86+ }
8087 $ tracked = $ currentInstances + $ tracked ;
8188 } elseif (count (self ::getInstance ()->factoryTracker ) > 0 ) {
8289 self ::getInstance ()->getLogger ()->warning (
Original file line number Diff line number Diff line change @@ -39,10 +39,10 @@ public function testMultipleClientInstantiation()
3939 $ logger ->expects ($ this ->any ())
4040 ->method ('warning ' )
4141 ->with ($ this ->logicalOr (
42- $ this ->equalTo ("Factory Instantiation: You already have 1 factory/ies with this API Key. "
42+ $ this ->equalTo ("Factory Instantiation: You already have 1 factory with this API Key. "
4343 . "We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing "
4444 . "it throughout your application. " ),
45- $ this ->equalTo ("Factory Instantiation: You already have 2 factory/ies with this API Key. "
45+ $ this ->equalTo ("Factory Instantiation: You already have 2 factories with this API Key. "
4646 . "We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing "
4747 . "it throughout your application. " ),
4848 $ this ->equalTo ("Factory Instantiation: You already have an instance of the Split factory. "
You can’t perform that action at this time.
0 commit comments