Skip to content

Commit 1940b8d

Browse files
committed
updated wording split
1 parent 10cd620 commit 1940b8d

16 files changed

Lines changed: 196 additions & 198 deletions

CHANGES.txt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
- Added flag `IPAddressesEnabled` into options to enable/disable sending MachineName and MachineIP when data is posted in headers.
4242

4343
6.2.2 (Sep 18, 2019)
44-
- Fetch multiple splits at once on getTreatments/getTreatmentsWithConfig
44+
- Fetch multiple feature flags at once on getTreatments/getTreatmentsWithConfig
4545
- Removed MatcherClient (DependencyMatcher now uses Evaluator directly)
4646
- Removed shared memory.
4747
- Several code cleanups
@@ -52,7 +52,7 @@
5252

5353
6.2.0 (May 30, 2019)
5454
- Added validation for TrafficType in track calls.
55-
- Added validation when split does not exist on treatments and manager calls.
55+
- Added validation when feature flag does not exist on treatments and manager calls.
5656
- Added multiple factory instantiation check.
5757
- Removed producer modules.
5858
- Added properties to track method.
@@ -94,7 +94,7 @@
9494
- Downgrade logging level for shared memory messages
9595

9696
5.2.3: (Sep 5, 2017)
97-
- Adding hotfix to return empty splits array in SplitManager when redis is empty.
97+
- Adding hotfix to return empty feature flags array in SplitManager when redis is empty.
9898

9999
5.2.2: (Aug 1, 2017)
100100
- Adding hotfix to return CONTROL if redis is down instead of failing.

src/SplitIO/Grammar/Split.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(array $split)
5151
$this->configurations = isset($split['configurations']) && count($split['configurations']) > 0 ?
5252
$split['configurations'] : null;
5353

54-
SplitApp::logger()->info("Constructing Split: ".$this->name);
54+
SplitApp::logger()->info("Constructing Feature Flag: ".$this->name);
5555

5656
if (isset($split['conditions']) && is_array($split['conditions'])) {
5757
$this->conditions = array();

src/SplitIO/Sdk/Client.php

Lines changed: 45 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -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) {

src/SplitIO/Sdk/ClientInterface.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface ClientInterface
1212
* <li>Any of the parameters were null</li>
1313
* <li>There was an exception</li>
1414
* <li>The SDK does not know this feature flag</li>
15-
* <li>The feature flag was deleted through the web console.</li>
15+
* <li>The feature flag was deleted through the Split user interface.</li>
1616
* </ol>
1717
* 'control' is a reserved treatment, to highlight these
1818
* exceptional circumstances.
@@ -48,7 +48,7 @@ public function getTreatment($key, $featureFlagName, array $attributes = null);
4848
* <li>Any of the parameters were null</li>
4949
* <li>There was an exception</li>
5050
* <li>The SDK does not know this feature flag</li>
51-
* <li>The feature flag was deleted through the web console.</li>
51+
* <li>The feature flag was deleted through the Split user interface.</li>
5252
* </ol>
5353
* 'control' is a reserved treatment, to highlight these
5454
* exceptional circumstances.

src/SplitIO/Sdk/Impressions/ImpressionLabel.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class ImpressionLabel
99
{
1010
/**
11-
* Condition: Split Was Killed
11+
* Condition: Feature flag Was Killed
1212
* Treatment: Default treatment
1313
* Label: killed
1414
*/
@@ -22,7 +22,7 @@ class ImpressionLabel
2222
const NO_CONDITION_MATCHED = "default rule";
2323

2424
/**
25-
* Condition: Split definition was not found
25+
* Condition: Feature flag definition was not found
2626
* Treatment: control
2727
* Label: split not found
2828
*/

0 commit comments

Comments
 (0)