@@ -43,11 +43,6 @@ class Client implements ClientInterface
43
43
*/
44
44
private $ eventCache ;
45
45
46
- /**
47
- * @var \SplitIO\Sdk\Validator\InputValidator
48
- */
49
- private $ inputValidator ;
50
-
51
46
/**
52
47
* @param array $options
53
48
* @param array $storages
@@ -66,7 +61,6 @@ public function __construct($storages, $options = array())
66
61
$ this ->queueMetadata = new QueueMetadataMessage (
67
62
isset ($ options ['IPAddressesEnabled ' ]) ? $ options ['IPAddressesEnabled ' ] : true
68
63
);
69
- $ this ->inputValidator = new InputValidator ($ this ->splitCache );
70
64
}
71
65
72
66
/**
@@ -103,17 +97,17 @@ private function createImpression($key, $feature, $treatment, $changeNumber, $la
103
97
*/
104
98
private function doInputValidationForTreatment ($ key , $ featureName , array $ attributes = null , $ operation )
105
99
{
106
- $ key = $ this -> inputValidator -> validateKey ($ key , $ operation );
100
+ $ key = InputValidator:: validateKey ($ key , $ operation );
107
101
if (is_null ($ key )) {
108
102
return null ;
109
103
}
110
104
111
- $ featureName = $ this -> inputValidator -> validateFeatureName ($ featureName , $ operation );
105
+ $ featureName = InputValidator:: validateFeatureName ($ featureName , $ operation );
112
106
if (is_null ($ featureName )) {
113
107
return null ;
114
108
}
115
109
116
- if (!$ this -> inputValidator -> validAttributes ($ attributes , $ operation )) {
110
+ if (!InputValidator:: validAttributes ($ attributes , $ operation )) {
117
111
return null ;
118
112
}
119
113
@@ -148,7 +142,7 @@ private function doEvaluation($operation, $metricName, $key, $featureName, $attr
148
142
$ featureName = $ inputValidation ['featureName ' ];
149
143
try {
150
144
$ result = $ this ->evaluator ->evaluateFeature ($ matchingKey , $ bucketingKey , $ featureName , $ attributes );
151
- if (!$ this -> inputValidator -> isSplitFound ($ result ['impression ' ]['label ' ], $ featureName , $ operation )) {
145
+ if (!InputValidator:: isSplitFound ($ result ['impression ' ]['label ' ], $ featureName , $ operation )) {
152
146
return $ default ;
153
147
}
154
148
// Creates impression
@@ -244,13 +238,13 @@ public function getTreatmentWithConfig($key, $featureName, array $attributes = n
244
238
*/
245
239
private function doInputValidationForTreatments ($ key , $ featureNames , array $ attributes = null , $ operation )
246
240
{
247
- $ splitNames = $ this -> inputValidator -> validateFeatureNames ($ featureNames , $ operation );
241
+ $ splitNames = InputValidator:: validateFeatureNames ($ featureNames , $ operation );
248
242
if (is_null ($ splitNames )) {
249
243
return null ;
250
244
}
251
245
252
- $ key = $ this -> inputValidator -> validateKey ($ key , $ operation );
253
- if (is_null ($ key ) || !$ this -> inputValidator -> validAttributes ($ attributes , $ operation )) {
246
+ $ key = InputValidator:: validateKey ($ key , $ operation );
247
+ if (is_null ($ key ) || !InputValidator:: validAttributes ($ attributes , $ operation )) {
254
248
return array (
255
249
'controlTreatments ' => array_fill_keys (
256
250
$ splitNames ,
@@ -320,7 +314,7 @@ private function doEvaluationForTreatments($operation, $metricName, $key, $featu
320
314
$ attributes
321
315
);
322
316
foreach ($ evaluationResults ['evaluations ' ] as $ splitName => $ evalResult ) {
323
- if ($ this -> inputValidator -> isSplitFound ($ evalResult ['impression ' ]['label ' ], $ splitName , $ operation )) {
317
+ if (InputValidator:: isSplitFound ($ evalResult ['impression ' ]['label ' ], $ splitName , $ operation )) {
324
318
// Creates impression
325
319
$ impressions [] = $ this ->createImpression (
326
320
$ matchingKey ,
@@ -368,7 +362,7 @@ function ($feature) {
368
362
);
369
363
} catch (\Exception $ e ) {
370
364
SplitApp::logger ()->critical ('getTreatments method is throwing exceptions ' );
371
- $ splitNames = $ this -> inputValidator -> validateFeatureNames ($ featureNames , 'getTreatments ' );
365
+ $ splitNames = InputValidator:: validateFeatureNames ($ featureNames , 'getTreatments ' );
372
366
return is_null ($ splitNames ) ? array () : array_fill_keys ($ splitNames , TreatmentEnum::CONTROL );
373
367
}
374
368
}
@@ -388,7 +382,7 @@ public function getTreatmentsWithConfig($key, $featureNames, array $attributes =
388
382
);
389
383
} catch (\Exception $ e ) {
390
384
SplitApp::logger ()->critical ('getTreatmentsWithConfig method is throwing exceptions ' );
391
- $ splitNames = $ this -> inputValidator -> validateFeatureNames ($ featureNames , 'getTreatmentsWithConfig ' );
385
+ $ splitNames = InputValidator:: validateFeatureNames ($ featureNames , 'getTreatmentsWithConfig ' );
392
386
return is_null ($ splitNames ) ? array () :
393
387
array_fill_keys ($ splitNames , array ('treatment ' => TreatmentEnum::CONTROL , 'config ' => null ));
394
388
}
@@ -423,11 +417,11 @@ public function isTreatment($key, $featureName, $treatment)
423
417
*/
424
418
public function track ($ key , $ trafficType , $ eventType , $ value = null , $ properties = null )
425
419
{
426
- $ key = $ this -> inputValidator -> validateTrackKey ($ key );
427
- $ trafficType = $ this ->inputValidator -> validateTrafficType ( $ trafficType );
428
- $ eventType = $ this -> inputValidator -> validateEventType ($ eventType );
429
- $ value = $ this -> inputValidator -> validateValue ($ value );
430
- $ properties = $ this -> inputValidator -> validProperties ($ properties );
420
+ $ key = InputValidator:: validateTrackKey ($ key );
421
+ $ trafficType = InputValidator:: validateTrafficType ( $ this ->splitCache , $ trafficType );
422
+ $ eventType = InputValidator:: validateEventType ($ eventType );
423
+ $ value = InputValidator:: validateValue ($ value );
424
+ $ properties = InputValidator:: validProperties ($ properties );
431
425
432
426
if (is_null ($ key ) || is_null ($ trafficType ) || is_null ($ eventType ) || $ value === false
433
427
|| $ properties === false ) {
0 commit comments