@@ -47,7 +47,7 @@ public function __construct($options = array())
4747 * Builds new Impression object
4848 *
4949 * @param $matchingKey
50- * @param $feature
50+ * @param $featureFlag
5151 * @param $treatment
5252 * @param string $label
5353 * @param null $time
@@ -56,34 +56,34 @@ public function __construct($options = array())
5656 *
5757 * @return \SplitIO\Sdk\Impressions\Impression
5858 */
59- private function createImpression ($ key , $ feature , $ treatment , $ changeNumber , $ label = '' , $ bucketingKey = null )
59+ private function createImpression ($ key , $ featureFlag , $ treatment , $ changeNumber , $ label = '' , $ bucketingKey = null )
6060 {
6161 if (!$ this ->labelsEnabled ) {
6262 $ label = null ;
6363 }
64- $ impression = new Impression ($ key , $ feature , $ treatment , $ label , null , $ changeNumber , $ bucketingKey );
64+ $ impression = new Impression ($ key , $ featureFlag , $ treatment , $ label , null , $ changeNumber , $ bucketingKey );
6565 return $ impression ;
6666 }
6767
6868 /**
6969 * Verifies inputs for getTreatment and getTreatmentWithConfig methods
7070 *
7171 * @param $key
72- * @param $featureName
72+ * @param $featureFlagName
7373 * @param $attributes
7474 * @param $operation
7575 *
7676 * @return null|mixed
7777 */
78- private function doInputValidationForTreatment ($ key , $ featureName , array $ attributes = null , $ operation )
78+ private function doInputValidationForTreatment ($ key , $ featureFlagName , array $ attributes = null , $ operation )
7979 {
8080 $ key = InputValidator::validateKey ($ key , $ operation );
8181 if (is_null ($ key )) {
8282 return null ;
8383 }
8484
85- $ featureName = InputValidator::validateFeatureName ( $ featureName , $ operation );
86- if (is_null ($ featureName )) {
85+ $ featureFlag = InputValidator::validateFeatureFlagName ( $ featureFlagName , $ operation );
86+ if (is_null ($ featureFlag )) {
8787 return null ;
8888 }
8989
@@ -94,7 +94,7 @@ private function doInputValidationForTreatment($key, $featureName, array $attrib
9494 return array (
9595 'matchingKey ' => $ key ['matchingKey ' ],
9696 'bucketingKey ' => $ key ['bucketingKey ' ],
97- 'featureName ' => $ featureName
97+ 'featureFlagName ' => $ featureFlag
9898 );
9999 }
100100
@@ -104,31 +104,31 @@ private function doInputValidationForTreatment($key, $featureName, array $attrib
104104 * @param $operation
105105 * @param $metricName
106106 * @param $key
107- * @param $featureName
107+ * @param $featureFlagName
108108 * @param $attributes
109109 *
110110 * @return mixed
111111 */
112- private function doEvaluation ($ operation , $ metricName , $ key , $ featureName , $ attributes )
112+ private function doEvaluation ($ operation , $ metricName , $ key , $ featureFlagName , $ attributes )
113113 {
114114 $ default = array ('treatment ' => TreatmentEnum::CONTROL , 'config ' => null );
115115
116- $ inputValidation = $ this ->doInputValidationForTreatment ($ key , $ featureName , $ attributes , $ operation );
116+ $ inputValidation = $ this ->doInputValidationForTreatment ($ key , $ featureFlagName , $ attributes , $ operation );
117117 if (is_null ($ inputValidation )) {
118118 return $ default ;
119119 }
120120 $ matchingKey = $ inputValidation ['matchingKey ' ];
121121 $ bucketingKey = $ inputValidation ['bucketingKey ' ];
122- $ featureName = $ inputValidation ['featureName ' ];
122+ $ featureFlagName = $ inputValidation ['featureFlagName ' ];
123123 try {
124- $ result = $ this ->evaluator ->evaluateFeature ($ matchingKey , $ bucketingKey , $ featureName , $ attributes );
125- if (!InputValidator::isSplitFound ($ result ['impression ' ]['label ' ], $ featureName , $ operation )) {
124+ $ result = $ this ->evaluator ->evaluateFeature ($ matchingKey , $ bucketingKey , $ featureFlagName , $ attributes );
125+ if (!InputValidator::isSplitFound ($ result ['impression ' ]['label ' ], $ featureFlagName , $ operation )) {
126126 return $ default ;
127127 }
128128 // Creates impression
129129 $ impression = $ this ->createImpression (
130130 $ matchingKey ,
131- $ featureName ,
131+ $ featureFlagName ,
132132 $ result ['treatment ' ],
133133 $ result ['impression ' ]['changeNumber ' ],
134134 $ result ['impression ' ]['label ' ],
@@ -150,7 +150,7 @@ private function doEvaluation($operation, $metricName, $key, $featureName, $attr
150150 // Creates impression
151151 $ impression = $ this ->createImpression (
152152 $ matchingKey ,
153- $ featureName ,
153+ $ featureFlagName ,
154154 TreatmentEnum::CONTROL ,
155155 -1 , // At this point we have no information on the real changeNumber (redis might have failed)
156156 ImpressionLabel::EXCEPTION ,
@@ -160,7 +160,7 @@ private function doEvaluation($operation, $metricName, $key, $featureName, $attr
160160 } catch (\Exception $ e ) {
161161 SplitApp::logger ()->critical (
162162 "An error occurred when attempting to log impression for " .
163- "feature : $ featureName , key: $ matchingKey "
163+ "featureFlagName : $ featureFlagName , key: $ matchingKey "
164164 );
165165 SplitApp::logger ()->critical ($ e );
166166 }
@@ -190,14 +190,14 @@ public function getTreatment($key, $featureName, array $attributes = null)
190190 /**
191191 * @inheritdoc
192192 */
193- public function getTreatmentWithConfig ($ key , $ featureName , array $ attributes = null )
193+ public function getTreatmentWithConfig ($ key , $ featureFlagName , array $ attributes = null )
194194 {
195195 try {
196196 return $ this ->doEvaluation (
197197 'getTreatmentWithConfig ' ,
198198 Metrics::MNAME_SDK_GET_TREATMENT_WITH_CONFIG ,
199199 $ key ,
200- $ featureName ,
200+ $ featureFlagName ,
201201 $ attributes
202202 );
203203 } catch (\Exception $ e ) {
@@ -216,18 +216,18 @@ public function getTreatmentWithConfig($key, $featureName, array $attributes = n
216216 *
217217 * @return null|mixed
218218 */
219- private function doInputValidationForTreatments ($ key , $ featureNames , array $ attributes = null , $ operation )
219+ private function doInputValidationForTreatments ($ key , $ featureFlagNames , array $ attributes = null , $ operation )
220220 {
221- $ splitNames = InputValidator::validateFeatureNames ( $ featureNames , $ operation );
222- if (is_null ($ splitNames )) {
221+ $ featureFlags = InputValidator::validateFeatureFlagNames ( $ featureFlagNames , $ operation );
222+ if (is_null ($ featureFlags )) {
223223 return null ;
224224 }
225225
226226 $ key = InputValidator::validateKey ($ key , $ operation );
227227 if (is_null ($ key ) || !InputValidator::validAttributes ($ attributes , $ operation )) {
228228 return array (
229229 'controlTreatments ' => array_fill_keys (
230- $ splitNames ,
230+ $ featureFlags ,
231231 array ('treatment ' => TreatmentEnum::CONTROL , 'config ' => null )
232232 ),
233233 );
@@ -236,7 +236,7 @@ private function doInputValidationForTreatments($key, $featureNames, array $attr
236236 return array (
237237 'matchingKey ' => $ key ['matchingKey ' ],
238238 'bucketingKey ' => $ key ['bucketingKey ' ],
239- 'featureNames ' => $ splitNames ,
239+ 'featureFlagNames ' => $ featureFlags ,
240240 );
241241 }
242242
@@ -260,14 +260,14 @@ private function registerData($impressions, $attributes, $metricName, $latency =
260260 * @param $operation
261261 * @param $metricName
262262 * @param $key
263- * @param $featureNames
263+ * @param $featureFlagNames
264264 * @param $attributes
265265 *
266266 * @return mixed
267267 */
268- private function doEvaluationForTreatments ($ operation , $ metricName , $ key , $ featureNames , $ attributes )
268+ private function doEvaluationForTreatments ($ operation , $ metricName , $ key , $ featureFlagNames , $ attributes )
269269 {
270- $ inputValidation = $ this ->doInputValidationForTreatments ($ key , $ featureNames , $ attributes , $ operation );
270+ $ inputValidation = $ this ->doInputValidationForTreatments ($ key , $ featureFlagNames , $ attributes , $ operation );
271271 if (is_null ($ inputValidation )) {
272272 return array ();
273273 }
@@ -277,34 +277,34 @@ private function doEvaluationForTreatments($operation, $metricName, $key, $featu
277277
278278 $ matchingKey = $ inputValidation ['matchingKey ' ];
279279 $ bucketingKey = $ inputValidation ['bucketingKey ' ];
280- $ splitNames = $ inputValidation ['featureNames ' ];
280+ $ featureFlags = $ inputValidation ['featureFlagNames ' ];
281281
282282 try {
283283 $ result = array ();
284284 $ impressions = array ();
285285 $ evaluationResults = $ this ->evaluator ->evaluateFeatures (
286286 $ matchingKey ,
287287 $ bucketingKey ,
288- $ splitNames ,
288+ $ featureFlags ,
289289 $ attributes
290290 );
291- foreach ($ evaluationResults ['evaluations ' ] as $ splitName => $ evalResult ) {
292- if (InputValidator::isSplitFound ($ evalResult ['impression ' ]['label ' ], $ splitName , $ operation )) {
291+ foreach ($ evaluationResults ['evaluations ' ] as $ featureFlag => $ evalResult ) {
292+ if (InputValidator::isSplitFound ($ evalResult ['impression ' ]['label ' ], $ featureFlag , $ operation )) {
293293 // Creates impression
294294 $ impressions [] = $ this ->createImpression (
295295 $ matchingKey ,
296- $ splitName ,
296+ $ featureFlag ,
297297 $ evalResult ['treatment ' ],
298298 $ evalResult ['impression ' ]['changeNumber ' ],
299299 $ evalResult ['impression ' ]['label ' ],
300300 $ bucketingKey
301301 );
302- $ result [$ splitName ] = array (
302+ $ result [$ featureFlag ] = array (
303303 'treatment ' => $ evalResult ['treatment ' ],
304304 'config ' => $ evalResult ['config ' ],
305305 );
306306 } else {
307- $ result [$ splitName ] = array ('treatment ' => TreatmentEnum::CONTROL , 'config ' => null );
307+ $ result [$ featureFlag ] = array ('treatment ' => TreatmentEnum::CONTROL , 'config ' => null );
308308 }
309309 }
310310 $ this ->registerData ($ impressions , $ attributes , $ metricName , $ evaluationResults ['latency ' ]);
@@ -320,7 +320,7 @@ private function doEvaluationForTreatments($operation, $metricName, $key, $featu
320320 /**
321321 * @inheritdoc
322322 */
323- public function getTreatments ($ key , $ featureNames , array $ attributes = null )
323+ public function getTreatments ($ key , $ featureFlagNames , array $ attributes = null )
324324 {
325325 try {
326326 return array_map (
@@ -331,45 +331,45 @@ function ($feature) {
331331 'getTreatments ' ,
332332 Metrics::MNAME_SDK_GET_TREATMENTS ,
333333 $ key ,
334- $ featureNames ,
334+ $ featureFlagNames ,
335335 $ attributes
336336 )
337337 );
338338 } catch (\Exception $ e ) {
339339 SplitApp::logger ()->critical ('getTreatments method is throwing exceptions ' );
340- $ splitNames = InputValidator::validateFeatureNames ( $ featureNames , 'getTreatments ' );
341- return is_null ($ splitNames ) ? array () : array_fill_keys ($ splitNames , TreatmentEnum::CONTROL );
340+ $ featureFlags = InputValidator::validateFeatureFlagNames ( $ featureFlagNames , 'getTreatments ' );
341+ return is_null ($ featureFlags ) ? array () : array_fill_keys ($ featureFlags , TreatmentEnum::CONTROL );
342342 }
343343 }
344344
345345 /**
346346 * @inheritdoc
347347 */
348- public function getTreatmentsWithConfig ($ key , $ featureNames , array $ attributes = null )
348+ public function getTreatmentsWithConfig ($ key , $ featureFlagNames , array $ attributes = null )
349349 {
350350 try {
351351 return $ this ->doEvaluationForTreatments (
352352 'getTreatmentsWithConfig ' ,
353353 Metrics::MNAME_SDK_GET_TREATMENTS_WITH_CONFIG ,
354354 $ key ,
355- $ featureNames ,
355+ $ featureFlagNames ,
356356 $ attributes
357357 );
358358 } catch (\Exception $ e ) {
359359 SplitApp::logger ()->critical ('getTreatmentsWithConfig method is throwing exceptions ' );
360- $ splitNames = InputValidator::validateFeatureNames ( $ featureNames , 'getTreatmentsWithConfig ' );
361- return is_null ($ splitNames ) ? array () :
362- array_fill_keys ($ splitNames , array ('treatment ' => TreatmentEnum::CONTROL , 'config ' => null ));
360+ $ featureFlags = InputValidator::validateFeatureFlagNames ( $ featureFlagNames , 'getTreatmentsWithConfig ' );
361+ return is_null ($ featureFlags ) ? array () :
362+ array_fill_keys ($ featureFlags , array ('treatment ' => TreatmentEnum::CONTROL , 'config ' => null ));
363363 }
364364 }
365365
366366 /**
367367 * @inheritdoc
368368 */
369- public function isTreatment ($ key , $ featureName , $ treatment )
369+ public function isTreatment ($ key , $ featureFlagName , $ treatment )
370370 {
371371 try {
372- $ calculatedTreatment = $ this ->getTreatment ($ key , $ featureName );
372+ $ calculatedTreatment = $ this ->getTreatment ($ key , $ featureFlagName );
373373
374374 if ($ calculatedTreatment !== TreatmentEnum::CONTROL ) {
375375 if ($ treatment == $ calculatedTreatment ) {
0 commit comments