File tree 2 files changed +15
-8
lines changed
src/SplitIO/Component/Common
tests/Suite/InputValidation
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)
71
71
$ tracked = 1 ;
72
72
if (isset (self ::getInstance ()->factoryTracker [$ apiKey ])) {
73
73
$ 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
+ }
80
87
$ tracked = $ currentInstances + $ tracked ;
81
88
} elseif (count (self ::getInstance ()->factoryTracker ) > 0 ) {
82
89
self ::getInstance ()->getLogger ()->warning (
Original file line number Diff line number Diff line change @@ -39,10 +39,10 @@ public function testMultipleClientInstantiation()
39
39
$ logger ->expects ($ this ->any ())
40
40
->method ('warning ' )
41
41
->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. "
43
43
. "We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing "
44
44
. "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. "
46
46
. "We recommend keeping only one instance of the factory at all times (Singleton pattern) and reusing "
47
47
. "it throughout your application. " ),
48
48
$ 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