diff --git a/CHANGES.txt b/CHANGES.txt index 9f75675d..8093bd5c 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -41,7 +41,7 @@ - Added flag `IPAddressesEnabled` into options to enable/disable sending MachineName and MachineIP when data is posted in headers. 6.2.2 (Sep 18, 2019) - - Fetch multiple splits at once on getTreatments/getTreatmentsWithConfig + - Fetch multiple feature flags at once on getTreatments/getTreatmentsWithConfig - Removed MatcherClient (DependencyMatcher now uses Evaluator directly) - Removed shared memory. - Several code cleanups @@ -52,7 +52,7 @@ 6.2.0 (May 30, 2019) - Added validation for TrafficType in track calls. - - Added validation when split does not exist on treatments and manager calls. + - Added validation when feature flag does not exist on treatments and manager calls. - Added multiple factory instantiation check. - Removed producer modules. - Added properties to track method. @@ -94,7 +94,7 @@ - Downgrade logging level for shared memory messages 5.2.3: (Sep 5, 2017) - - Adding hotfix to return empty splits array in SplitManager when redis is empty. + - Adding hotfix to return empty feature flags array in SplitManager when redis is empty. 5.2.2: (Aug 1, 2017) - Adding hotfix to return CONTROL if redis is down instead of failing. diff --git a/LICENSE b/LICENSE index 051b5fd9..65f5999d 100644 --- a/LICENSE +++ b/LICENSE @@ -1,4 +1,4 @@ -Copyright © 2022 Split Software, Inc. +Copyright © 2023 Split Software, Inc. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. diff --git a/README.md b/README.md index 10c1d17e..daa54d57 100644 --- a/README.md +++ b/README.md @@ -4,23 +4,24 @@ [](https://packagist.org/packages/splitsoftware/split-sdk-php) [](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK) -This SDK is designed to work with Split, the platform for controlled rollouts, serving features to your users via the Split feature flag to manage your complete customer experience. +## Overview +This SDK is designed to work with Split, the platform for controlled rollouts, which serves features to your users via feature flags to manage your complete customer experience. ## Compatibility This SDK is compatible with PHP 7.3 and above. ## Getting started Below is a simple example that describes the instantiation and most basic usage of our SDK. -Keep in mind that since PHP does not have the ability to share memory between processes the use of the [split-synchronizer](https://help.split.io/hc/en-us/articles/360019686092-Split-Synchronizer-Proxy) is mandatory for this SDK. +Keep in mind that since PHP does not have the ability to share memory between processes the use of the [split-synchronizer](https://help.split.io/hc/en-us/articles/360019686092-Split-Synchronizer) is mandatory for this SDK. ```php ['adapter' => 'predis']]; -$splitFactory = \SplitIO\Sdk::factory('SDK_API_KEY', $sdkConfig); +$splitFactory = \SplitIO\Sdk::factory('YOUR_SDK_KEY', $sdkConfig); $splitClient = $splitFactory->client(); -$treatment = $splitClient->getTreatment('CUSTOMER_ID','SPLIT_NAME'); +$treatment = $splitClient->getTreatment('CUSTOMER_ID','FEATURE_FLAG_NAME'); if ($treatment === 'on') { // Feature is enabled for this user! } elseif ($treatment === 'off') { @@ -30,9 +31,11 @@ if ($treatment === 'on') { } ``` +Please refer to [our official docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK) to learn about all the functionality provided by our SDK and the configuration options available for tailoring it to your current application setup. + ## Submitting issues -The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/php-client/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner. + The Split team monitors all issues submitted to this [issue tracker](https://github.com/splitio/php-client/issues). We encourage you to use this issue tracker to submit any bug reports, feedback, and feature enhancements. We'll do our best to respond in a timely manner. ## Contributing Please see [Contributors Guide](CONTRIBUTORS-GUIDE.md) to find all you need to submit a Pull Request (PR). @@ -48,16 +51,21 @@ To learn more about Split, contact hello@split.io, or get started with feature f Split has built and maintains SDKs for: +* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK) +* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK) +* Angular [Github](https://github.com/splitio/angular-sdk-plugin) [Docs](https://help.split.io/hc/en-us/articles/6495326064397-Angular-utilities) +* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK) +* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK) * Java [Github](https://github.com/splitio/java-client) [Docs](https://help.split.io/hc/en-us/articles/360020405151-Java-SDK) -* Javascript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK) +* JavaScript [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020448791-JavaScript-SDK) +* JavaScript for Browser [Github](https://github.com/splitio/javascript-browser-client) [Docs](https://help.split.io/hc/en-us/articles/360058730852-Browser-SDK) * Node [Github](https://github.com/splitio/javascript-client) [Docs](https://help.split.io/hc/en-us/articles/360020564931-Node-js-SDK) -* .NET [Github](https://github.com/splitio/dotnet-client) [Docs](https://help.split.io/hc/en-us/articles/360020240172--NET-SDK) -* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK) * PHP [Github](https://github.com/splitio/php-client) [Docs](https://help.split.io/hc/en-us/articles/360020350372-PHP-SDK) * Python [Github](https://github.com/splitio/python-client) [Docs](https://help.split.io/hc/en-us/articles/360020359652-Python-SDK) -* GO [Github](https://github.com/splitio/go-client) [Docs](https://help.split.io/hc/en-us/articles/360020093652-Go-SDK) -* Android [Github](https://github.com/splitio/android-client) [Docs](https://help.split.io/hc/en-us/articles/360020343291-Android-SDK) -* iOS [Github](https://github.com/splitio/ios-client) [Docs](https://help.split.io/hc/en-us/articles/360020401491-iOS-SDK) +* React [Github](https://github.com/splitio/react-client) [Docs](https://help.split.io/hc/en-us/articles/360038825091-React-SDK) +* React Native [Github](https://github.com/splitio/react-native-client) [Docs](https://help.split.io/hc/en-us/articles/4406066357901-React-Native-SDK) +* Redux [Github](https://github.com/splitio/redux-client) [Docs](https://help.split.io/hc/en-us/articles/360038851551-Redux-SDK) +* Ruby [Github](https://github.com/splitio/ruby-client) [Docs](https://help.split.io/hc/en-us/articles/360020673251-Ruby-SDK) For a comprehensive list of open source projects visit our [Github page](https://github.com/splitio?utf8=%E2%9C%93&query=%20only%3Apublic%20). diff --git a/src/SplitIO/Grammar/Split.php b/src/SplitIO/Grammar/Split.php index 2ad0bddf..3e203dca 100644 --- a/src/SplitIO/Grammar/Split.php +++ b/src/SplitIO/Grammar/Split.php @@ -51,7 +51,7 @@ public function __construct(array $split) $this->configurations = isset($split['configurations']) && count($split['configurations']) > 0 ? $split['configurations'] : null; - SplitApp::logger()->info("Constructing Split: ".$this->name); + SplitApp::logger()->info("Constructing Feature Flag: ".$this->name); if (isset($split['conditions']) && is_array($split['conditions'])) { $this->conditions = array(); diff --git a/src/SplitIO/Sdk/Client.php b/src/SplitIO/Sdk/Client.php index 88b27b87..1867fb90 100644 --- a/src/SplitIO/Sdk/Client.php +++ b/src/SplitIO/Sdk/Client.php @@ -47,7 +47,7 @@ public function __construct($options = array()) * Builds new Impression object * * @param $matchingKey - * @param $feature + * @param $featureFlag * @param $treatment * @param string $label * @param null $time @@ -56,12 +56,12 @@ public function __construct($options = array()) * * @return \SplitIO\Sdk\Impressions\Impression */ - private function createImpression($key, $feature, $treatment, $changeNumber, $label = '', $bucketingKey = null) + private function createImpression($key, $featureFlag, $treatment, $changeNumber, $label = '', $bucketingKey = null) { if (!$this->labelsEnabled) { $label = null; } - $impression = new Impression($key, $feature, $treatment, $label, null, $changeNumber, $bucketingKey); + $impression = new Impression($key, $featureFlag, $treatment, $label, null, $changeNumber, $bucketingKey); return $impression; } @@ -69,21 +69,21 @@ private function createImpression($key, $feature, $treatment, $changeNumber, $la * Verifies inputs for getTreatment and getTreatmentWithConfig methods * * @param $key - * @param $featureName + * @param $featureFlagName * @param $attributes * @param $operation * * @return null|mixed */ - private function doInputValidationForTreatment($key, $featureName, array $attributes = null, $operation) + private function doInputValidationForTreatment($key, $featureFlagName, array $attributes = null, $operation) { $key = InputValidator::validateKey($key, $operation); if (is_null($key)) { return null; } - $featureName = InputValidator::validateFeatureName($featureName, $operation); - if (is_null($featureName)) { + $featureFlag = InputValidator::validateFeatureFlagName($featureFlagName, $operation); + if (is_null($featureFlag)) { return null; } @@ -94,7 +94,7 @@ private function doInputValidationForTreatment($key, $featureName, array $attrib return array( 'matchingKey' => $key['matchingKey'], 'bucketingKey' => $key['bucketingKey'], - 'featureName' => $featureName + 'featureFlagName' => $featureFlag ); } @@ -104,31 +104,31 @@ private function doInputValidationForTreatment($key, $featureName, array $attrib * @param $operation * @param $metricName * @param $key - * @param $featureName + * @param $featureFlagName * @param $attributes * * @return mixed */ - private function doEvaluation($operation, $metricName, $key, $featureName, $attributes) + private function doEvaluation($operation, $metricName, $key, $featureFlagName, $attributes) { $default = array('treatment' => TreatmentEnum::CONTROL, 'config' => null); - $inputValidation = $this->doInputValidationForTreatment($key, $featureName, $attributes, $operation); + $inputValidation = $this->doInputValidationForTreatment($key, $featureFlagName, $attributes, $operation); if (is_null($inputValidation)) { return $default; } $matchingKey = $inputValidation['matchingKey']; $bucketingKey = $inputValidation['bucketingKey']; - $featureName = $inputValidation['featureName']; + $featureFlagName = $inputValidation['featureFlagName']; try { - $result = $this->evaluator->evaluateFeature($matchingKey, $bucketingKey, $featureName, $attributes); - if (!InputValidator::isSplitFound($result['impression']['label'], $featureName, $operation)) { + $result = $this->evaluator->evaluateFeature($matchingKey, $bucketingKey, $featureFlagName, $attributes); + if (!InputValidator::isSplitFound($result['impression']['label'], $featureFlagName, $operation)) { return $default; } // Creates impression $impression = $this->createImpression( $matchingKey, - $featureName, + $featureFlagName, $result['treatment'], $result['impression']['changeNumber'], $result['impression']['label'], @@ -150,7 +150,7 @@ private function doEvaluation($operation, $metricName, $key, $featureName, $attr // Creates impression $impression = $this->createImpression( $matchingKey, - $featureName, + $featureFlagName, TreatmentEnum::CONTROL, -1, // At this point we have no information on the real changeNumber (redis might have failed) ImpressionLabel::EXCEPTION, @@ -160,7 +160,7 @@ private function doEvaluation($operation, $metricName, $key, $featureName, $attr } catch (\Exception $e) { SplitApp::logger()->critical( "An error occurred when attempting to log impression for " . - "feature: $featureName, key: $matchingKey" + "featureFlagName: $featureFlagName, key: $matchingKey" ); SplitApp::logger()->critical($e); } @@ -190,14 +190,14 @@ public function getTreatment($key, $featureName, array $attributes = null) /** * @inheritdoc */ - public function getTreatmentWithConfig($key, $featureName, array $attributes = null) + public function getTreatmentWithConfig($key, $featureFlagName, array $attributes = null) { try { return $this->doEvaluation( 'getTreatmentWithConfig', Metrics::MNAME_SDK_GET_TREATMENT_WITH_CONFIG, $key, - $featureName, + $featureFlagName, $attributes ); } catch (\Exception $e) { @@ -216,10 +216,10 @@ public function getTreatmentWithConfig($key, $featureName, array $attributes = n * * @return null|mixed */ - private function doInputValidationForTreatments($key, $featureNames, array $attributes = null, $operation) + private function doInputValidationForTreatments($key, $featureFlagNames, array $attributes = null, $operation) { - $splitNames = InputValidator::validateFeatureNames($featureNames, $operation); - if (is_null($splitNames)) { + $featureFlags = InputValidator::validateFeatureFlagNames($featureFlagNames, $operation); + if (is_null($featureFlags)) { return null; } @@ -227,7 +227,7 @@ private function doInputValidationForTreatments($key, $featureNames, array $attr if (is_null($key) || !InputValidator::validAttributes($attributes, $operation)) { return array( 'controlTreatments' => array_fill_keys( - $splitNames, + $featureFlags, array('treatment' => TreatmentEnum::CONTROL, 'config' => null) ), ); @@ -236,7 +236,7 @@ private function doInputValidationForTreatments($key, $featureNames, array $attr return array( 'matchingKey' => $key['matchingKey'], 'bucketingKey' => $key['bucketingKey'], - 'featureNames' => $splitNames, + 'featureFlagNames' => $featureFlags, ); } @@ -260,14 +260,14 @@ private function registerData($impressions, $attributes, $metricName, $latency = * @param $operation * @param $metricName * @param $key - * @param $featureNames + * @param $featureFlagNames * @param $attributes * * @return mixed */ - private function doEvaluationForTreatments($operation, $metricName, $key, $featureNames, $attributes) + private function doEvaluationForTreatments($operation, $metricName, $key, $featureFlagNames, $attributes) { - $inputValidation = $this->doInputValidationForTreatments($key, $featureNames, $attributes, $operation); + $inputValidation = $this->doInputValidationForTreatments($key, $featureFlagNames, $attributes, $operation); if (is_null($inputValidation)) { return array(); } @@ -277,7 +277,7 @@ private function doEvaluationForTreatments($operation, $metricName, $key, $featu $matchingKey = $inputValidation['matchingKey']; $bucketingKey = $inputValidation['bucketingKey']; - $splitNames = $inputValidation['featureNames']; + $featureFlags = $inputValidation['featureFlagNames']; try { $result = array(); @@ -285,26 +285,26 @@ private function doEvaluationForTreatments($operation, $metricName, $key, $featu $evaluationResults = $this->evaluator->evaluateFeatures( $matchingKey, $bucketingKey, - $splitNames, + $featureFlags, $attributes ); - foreach ($evaluationResults['evaluations'] as $splitName => $evalResult) { - if (InputValidator::isSplitFound($evalResult['impression']['label'], $splitName, $operation)) { + foreach ($evaluationResults['evaluations'] as $featureFlag => $evalResult) { + if (InputValidator::isSplitFound($evalResult['impression']['label'], $featureFlag, $operation)) { // Creates impression $impressions[] = $this->createImpression( $matchingKey, - $splitName, + $featureFlag, $evalResult['treatment'], $evalResult['impression']['changeNumber'], $evalResult['impression']['label'], $bucketingKey ); - $result[$splitName] = array( + $result[$featureFlag] = array( 'treatment' => $evalResult['treatment'], 'config' => $evalResult['config'], ); } else { - $result[$splitName] = array('treatment' => TreatmentEnum::CONTROL, 'config' => null); + $result[$featureFlag] = array('treatment' => TreatmentEnum::CONTROL, 'config' => null); } } $this->registerData($impressions, $attributes, $metricName, $evaluationResults['latency']); @@ -320,7 +320,7 @@ private function doEvaluationForTreatments($operation, $metricName, $key, $featu /** * @inheritdoc */ - public function getTreatments($key, $featureNames, array $attributes = null) + public function getTreatments($key, $featureFlagNames, array $attributes = null) { try { return array_map( @@ -331,45 +331,45 @@ function ($feature) { 'getTreatments', Metrics::MNAME_SDK_GET_TREATMENTS, $key, - $featureNames, + $featureFlagNames, $attributes ) ); } catch (\Exception $e) { SplitApp::logger()->critical('getTreatments method is throwing exceptions'); - $splitNames = InputValidator::validateFeatureNames($featureNames, 'getTreatments'); - return is_null($splitNames) ? array() : array_fill_keys($splitNames, TreatmentEnum::CONTROL); + $featureFlags = InputValidator::validateFeatureFlagNames($featureFlagNames, 'getTreatments'); + return is_null($featureFlags) ? array() : array_fill_keys($featureFlags, TreatmentEnum::CONTROL); } } /** * @inheritdoc */ - public function getTreatmentsWithConfig($key, $featureNames, array $attributes = null) + public function getTreatmentsWithConfig($key, $featureFlagNames, array $attributes = null) { try { return $this->doEvaluationForTreatments( 'getTreatmentsWithConfig', Metrics::MNAME_SDK_GET_TREATMENTS_WITH_CONFIG, $key, - $featureNames, + $featureFlagNames, $attributes ); } catch (\Exception $e) { SplitApp::logger()->critical('getTreatmentsWithConfig method is throwing exceptions'); - $splitNames = InputValidator::validateFeatureNames($featureNames, 'getTreatmentsWithConfig'); - return is_null($splitNames) ? array() : - array_fill_keys($splitNames, array('treatment' => TreatmentEnum::CONTROL, 'config' => null)); + $featureFlags = InputValidator::validateFeatureFlagNames($featureFlagNames, 'getTreatmentsWithConfig'); + return is_null($featureFlags) ? array() : + array_fill_keys($featureFlags, array('treatment' => TreatmentEnum::CONTROL, 'config' => null)); } } /** * @inheritdoc */ - public function isTreatment($key, $featureName, $treatment) + public function isTreatment($key, $featureFlagName, $treatment) { try { - $calculatedTreatment = $this->getTreatment($key, $featureName); + $calculatedTreatment = $this->getTreatment($key, $featureFlagName); if ($calculatedTreatment !== TreatmentEnum::CONTROL) { if ($treatment == $calculatedTreatment) { diff --git a/src/SplitIO/Sdk/ClientInterface.php b/src/SplitIO/Sdk/ClientInterface.php index 67fd1666..d3b31eab 100644 --- a/src/SplitIO/Sdk/ClientInterface.php +++ b/src/SplitIO/Sdk/ClientInterface.php @@ -4,64 +4,64 @@ interface ClientInterface { /** - * Returns the treatment to show this id for this feature. - * The set of treatments for a feature can be configured - * on the Split web console. + * Returns the treatment to show this id for this feature flag. + * The set of treatments for a feature flag can be configured + * on the Split user interface. * This method returns the string 'control' if: *
- * The sdk returns the default treatment of this feature if: + * The sdk returns the default treatment of this feature flag if: *
* This method does not throw any exceptions. * It also never returns null. * * @param $key - * @param $featureName + * @param $featureFlagName * @param $attributes * @return string */ - public function getTreatment($key, $featureName, array $attributes = null); + public function getTreatment($key, $featureFlagName, array $attributes = null); /** * Returns an object with the treatment to show this id for this feature - * and the config provided. - * The set of treatments and config for a feature can be configured - * on the Split web console. + * flag and the config provided. + * The set of treatments and config for a feature flag can be configured + * on the Split user interface. * This method returns the string 'control' if: *
- * The sdk returns the default treatment of this feature if: + * The sdk returns the default treatment of this feature flag if: *
* This method does not throw any exceptions. @@ -72,95 +72,95 @@ public function getTreatment($key, $featureName, array $attributes = null); *
- * The sdk returns the default treatment of this feature if: + * The sdk returns the default treatment of this feature flag if: *
* This method does not throw any exceptions. * It also never returns null. * * @param $key - * @param $featureNames + * @param $featureFlagNames * @param $attributes * @return array */ - public function getTreatments($key, $featureNames, array $attributes = null); + public function getTreatments($key, $featureFlagNames, array $attributes = null); /** * Returns an associative array which each key will be * the treatment result and the config for each - * feature passed as parameter. - * The set of treatments for a feature can be configured - * on the Split web console and the config for + * feature flag passed as parameter. + * The set of treatments for a feature flag can be configured + * on the Split user interface and the config for * that treatment. * This method returns the string 'control' if: *
- * The sdk returns the default treatment of this feature if: + * The sdk returns the default treatment of this feature flag if: *
* This method does not throw any exceptions. * It also never returns null. * * @param $key - * @param $featureNames + * @param $featureFlagNames * @param $attributes * @return array */ - public function getTreatmentsWithConfig($key, $featureNames, array $attributes = null); + public function getTreatmentsWithConfig($key, $featureFlagNames, array $attributes = null); /** * A short-hand for *
- * (getTreatment(key, feature) == treatment) ? true : false;
+ * (getTreatment(key, featureFlagName) == treatment) ? true : false;
*
*
* This method never throws exceptions.
* Instead of throwing exceptions, it returns false.
*
* @param $key
- * @param $featureName
+ * @param $featureFlagName
* @param $treatment
* @return bool
*/
- public function isTreatment($key, $featureName, $treatment);
+ public function isTreatment($key, $featureFlagName, $treatment);
/**
* Method to send events
diff --git a/src/SplitIO/Sdk/Impressions/ImpressionLabel.php b/src/SplitIO/Sdk/Impressions/ImpressionLabel.php
index 5fdace77..1bf7c2a3 100644
--- a/src/SplitIO/Sdk/Impressions/ImpressionLabel.php
+++ b/src/SplitIO/Sdk/Impressions/ImpressionLabel.php
@@ -8,7 +8,7 @@
class ImpressionLabel
{
/**
- * Condition: Split Was Killed
+ * Condition: Feature flag Was Killed
* Treatment: Default treatment
* Label: killed
*/
@@ -22,7 +22,7 @@ class ImpressionLabel
const NO_CONDITION_MATCHED = "default rule";
/**
- * Condition: Split definition was not found
+ * Condition: Feature flag definition was not found
* Treatment: control
* Label: split not found
*/
diff --git a/src/SplitIO/Sdk/LocalhostClient.php b/src/SplitIO/Sdk/LocalhostClient.php
index 618f0113..ac86afa6 100644
--- a/src/SplitIO/Sdk/LocalhostClient.php
+++ b/src/SplitIO/Sdk/LocalhostClient.php
@@ -118,27 +118,27 @@ public function getSplits()
return $this->splits;
}
- public function doValidation($key, $featureName, $operation)
+ public function doValidation($key, $featureFlagName, $operation)
{
$key = InputValidator::validateKey($key, $operation);
if (is_null($key)) {
return null;
}
- $featureName = InputValidator::validateFeatureName($featureName, $operation);
- if (is_null($featureName)) {
+ $featureFlagName = InputValidator::validateFeatureFlagName($featureFlagName, $operation);
+ if (is_null($featureFlagName)) {
return null;
}
- return is_null($key) ? $featureName : ($featureName . ":" . $key["matchingKey"]);
+ return is_null($key) ? $featureFlagName : ($featureFlagName . ":" . $key["matchingKey"]);
}
/**
* @inheritdoc
*/
- public function getTreatment($key, $featureName, array $attributes = null)
+ public function getTreatment($key, $featureFlagName, array $attributes = null)
{
- $key = $this->doValidation($key, $featureName, "getTreatment");
+ $key = $this->doValidation($key, $featureFlagName, "getTreatment");
if (is_null($key)) {
return TreatmentEnum::CONTROL;
}
@@ -146,8 +146,8 @@ public function getTreatment($key, $featureName, array $attributes = null)
if (isset($this->splits[$key])) {
return $this->splits[$key]["treatment"];
} else {
- if (isset($this->splits[$featureName])) {
- return $this->splits[$featureName]["treatment"];
+ if (isset($this->splits[$featureFlagName])) {
+ return $this->splits[$featureFlagName]["treatment"];
}
}
@@ -157,14 +157,14 @@ public function getTreatment($key, $featureName, array $attributes = null)
/**
* @inheritdoc
*/
- public function getTreatmentWithConfig($key, $featureName, array $attributes = null)
+ public function getTreatmentWithConfig($key, $featureFlagName, array $attributes = null)
{
$treatmentResult = array(
"treatment" => TreatmentEnum::CONTROL,
"config" => null,
);
- $key = $this->doValidation($key, $featureName, "getTreatmentWithConfig");
+ $key = $this->doValidation($key, $featureFlagName, "getTreatmentWithConfig");
if (is_null($key)) {
return $treatmentResult;
}
@@ -175,10 +175,10 @@ public function getTreatmentWithConfig($key, $featureName, array $attributes = n
$treatmentResult["config"] = $this->splits[$key]["config"];
}
} else {
- if (isset($this->splits[$featureName])) {
- $treatmentResult["treatment"] = $this->splits[$featureName]["treatment"];
- if (isset($this->splits[$featureName]["config"])) {
- $treatmentResult["config"] = $this->splits[$featureName]["config"];
+ if (isset($this->splits[$featureFlagName])) {
+ $treatmentResult["treatment"] = $this->splits[$featureFlagName]["treatment"];
+ if (isset($this->splits[$featureFlagName]["config"])) {
+ $treatmentResult["config"] = $this->splits[$featureFlagName]["config"];
}
}
}
@@ -189,21 +189,21 @@ public function getTreatmentWithConfig($key, $featureName, array $attributes = n
/**
* @inheritdoc
*/
- public function getTreatments($key, $featureNames, array $attributes = null)
+ public function getTreatments($key, $featureFlagNames, array $attributes = null)
{
$result = array();
- $splitNames = InputValidator::validateFeatureNames($featureNames, "getTreatments");
- if (is_null($splitNames)) {
+ $featureFlags = InputValidator::validateFeatureFlagNames($featureFlagNames, "getTreatments");
+ if (is_null($featureFlags)) {
return $result;
}
$key = InputValidator::validateKey($key, "getTreatments");
if (is_null($key)) {
- return array_fill_keys($splitNames, TreatmentEnum::CONTROL);
+ return array_fill_keys($featureFlags, TreatmentEnum::CONTROL);
}
- foreach ($splitNames as $split) {
+ foreach ($featureFlags as $split) {
$result[$split] = $this->getTreatment($key["matchingKey"], $split, $attributes);
};
@@ -213,21 +213,21 @@ public function getTreatments($key, $featureNames, array $attributes = null)
/**
* @inheritdoc
*/
- public function getTreatmentsWithConfig($key, $featureNames, array $attributes = null)
+ public function getTreatmentsWithConfig($key, $featureFlagNames, array $attributes = null)
{
$result = array();
- $splitNames = InputValidator::validateFeatureNames($featureNames, "getTreatmentsWithConfig");
- if (is_null($splitNames)) {
+ $featureFlags = InputValidator::validateFeatureFlagNames($featureFlagNames, "getTreatmentsWithConfig");
+ if (is_null($featureFlags)) {
return $result;
}
$key = InputValidator::validateKey($key, "getTreatmentsWithConfig");
if (is_null($key)) {
- return array_fill_keys($splitNames, array('treatment' => TreatmentEnum::CONTROL, 'config' => null));
+ return array_fill_keys($featureFlags, array('treatment' => TreatmentEnum::CONTROL, 'config' => null));
}
- foreach ($splitNames as $split) {
+ foreach ($featureFlags as $split) {
$result[$split] = $this->getTreatmentWithConfig($key["matchingKey"], $split, $attributes);
};
@@ -237,9 +237,9 @@ public function getTreatmentsWithConfig($key, $featureNames, array $attributes =
/**
* @inheritdoc
*/
- public function isTreatment($key, $featureName, $treatment)
+ public function isTreatment($key, $featureFlagName, $treatment)
{
- $calculatedTreatment = $this->getTreatment($key, $featureName);
+ $calculatedTreatment = $this->getTreatment($key, $featureFlagName);
if ($calculatedTreatment !== TreatmentEnum::CONTROL) {
if ($treatment == $calculatedTreatment) {
diff --git a/src/SplitIO/Sdk/Manager/LocalhostSplitManager.php b/src/SplitIO/Sdk/Manager/LocalhostSplitManager.php
index d932cbfe..2bb3f7a5 100644
--- a/src/SplitIO/Sdk/Manager/LocalhostSplitManager.php
+++ b/src/SplitIO/Sdk/Manager/LocalhostSplitManager.php
@@ -14,25 +14,25 @@ public function __construct(array $splits)
if ($splits) {
foreach (array_keys($splits) as $concatenated) {
$splitted = explode(":", $concatenated);
- $featureName = $splitted[0];
+ $featureFlagName = $splitted[0];
$split = $splits[$concatenated];
- if (isset($splitDefinitions[$featureName])) {
+ if (isset($splitDefinitions[$featureFlagName])) {
array_push(
- $splitDefinitions[$featureName]["treatments"],
+ $splitDefinitions[$featureFlagName]["treatments"],
$split["treatment"]
);
- $splitDefinitions[$featureName]["treatments"] = array_unique(
- $splitDefinitions[$featureName]["treatments"]
+ $splitDefinitions[$featureFlagName]["treatments"] = array_unique(
+ $splitDefinitions[$featureFlagName]["treatments"]
);
if (isset($split["config"])) {
- $splitDefinitions[$featureName]["config"][ $split["treatment"]] = $split["config"];
+ $splitDefinitions[$featureFlagName]["config"][ $split["treatment"]] = $split["config"];
}
} else {
- $splitDefinitions[$featureName] = array(
+ $splitDefinitions[$featureFlagName] = array(
"treatments" => array($split["treatment"]),
);
if (isset($split["config"])) {
- $splitDefinitions[$featureName]["config"] = array($split["treatment"] => $split["config"]);
+ $splitDefinitions[$featureFlagName]["config"] = array($split["treatment"] => $split["config"]);
}
}
}
@@ -57,14 +57,14 @@ public function splits()
$_splits = array();
if ($this->splits) {
- foreach (array_keys($this->splits) as $featureName) {
- $configs = isset($this->splits[$featureName]["config"]) ?
- $this->splits[$featureName]["config"] : new StdClass;
+ foreach (array_keys($this->splits) as $featureFlagName) {
+ $configs = isset($this->splits[$featureFlagName]["config"]) ?
+ $this->splits[$featureFlagName]["config"] : new StdClass;
$_splits[] = new SplitView(
- $featureName,
+ $featureFlagName,
null,
false,
- $this->splits[$featureName]["treatments"],
+ $this->splits[$featureFlagName]["treatments"],
0,
$configs
);
@@ -74,21 +74,21 @@ public function splits()
return $_splits;
}
- public function split($featureName)
+ public function split($featureFlagName)
{
- $featureName = InputValidator::validateFeatureName($featureName, 'split');
- if (is_null($featureName)) {
+ $featureFlagName = InputValidator::validateFeatureFlagName($featureFlagName, 'split');
+ if (is_null($featureFlagName)) {
return null;
}
- if (isset($this->splits[$featureName])) {
- $configs = isset($this->splits[$featureName]["config"]) ?
- $this->splits[$featureName]["config"] : new StdClass;
+ if (isset($this->splits[$featureFlagName])) {
+ $configs = isset($this->splits[$featureFlagName]["config"]) ?
+ $this->splits[$featureFlagName]["config"] : new StdClass;
return new SplitView(
- $featureName,
+ $featureFlagName,
null,
false,
- $this->splits[$featureName]["treatments"],
+ $this->splits[$featureFlagName]["treatments"],
0,
$configs
);
diff --git a/src/SplitIO/Sdk/Manager/SplitManager.php b/src/SplitIO/Sdk/Manager/SplitManager.php
index 38e667d1..2acefb2d 100644
--- a/src/SplitIO/Sdk/Manager/SplitManager.php
+++ b/src/SplitIO/Sdk/Manager/SplitManager.php
@@ -2,8 +2,6 @@
namespace SplitIO\Sdk\Manager;
use \stdClass;
-use SplitIO\Component\Common\Di;
-use SplitIO\Grammar\Condition;
use SplitIO\Grammar\Split;
use SplitIO\Split as SplitApp;
use SplitIO\Component\Cache\SplitCache;
@@ -28,22 +26,22 @@ public function splits()
}
/**
- * @param $featureName
+ * @param $featureFlagName
* @return null|SplitView
*/
- public function split($featureName)
+ public function split($featureFlagName)
{
- $featureName = InputValidator::validateFeatureName($featureName, 'split');
- if (is_null($featureName)) {
+ $featureFlagName = InputValidator::validateFeatureFlagName($featureFlagName, 'split');
+ if (is_null($featureFlagName)) {
return null;
}
$cache = new SplitCache();
- $raw = $cache->getSplit($featureName);
+ $raw = $cache->getSplit($featureFlagName);
if (is_null($raw)) {
- SplitApp::logger()->warning("split: you passed " . $featureName
- . " that does not exist in this environment, please double check what Splits exist"
- . " in the web console.");
+ SplitApp::logger()->warning("split: you passed " . $featureFlagName
+ . " that does not exist in this environment, please double check what"
+ . " feature flags exist in the Split user interface.");
return null;
}
return self::parseSplitView($raw);
diff --git a/src/SplitIO/Sdk/Manager/SplitManagerInterface.php b/src/SplitIO/Sdk/Manager/SplitManagerInterface.php
index a0d8687e..f4475bd1 100644
--- a/src/SplitIO/Sdk/Manager/SplitManagerInterface.php
+++ b/src/SplitIO/Sdk/Manager/SplitManagerInterface.php
@@ -14,8 +14,8 @@ public function splitNames();
public function splits();
/**
- * @param $featureName
+ * @param $featureFlagName
* @return \SplitIO\Sdk\Manager\SplitView
*/
- public function split($featureName);
+ public function split($featureFlagName);
}
diff --git a/src/SplitIO/Sdk/Validator/InputValidator.php b/src/SplitIO/Sdk/Validator/InputValidator.php
index 6cdbf962..50905331 100644
--- a/src/SplitIO/Sdk/Validator/InputValidator.php
+++ b/src/SplitIO/Sdk/Validator/InputValidator.php
@@ -21,10 +21,10 @@ class InputValidator
* @param $operation
* @return true|false
*/
- public static function validString($value, $name, $operation)
+ public static function validString($value, $name, $nameType, $operation)
{
- if (self::checkIsNull($value, $name, $operation) or self::checkIsNotString($value, $name, $operation)
- or self::checkIsEmpty($value, $name, $operation)) {
+ if (self::checkIsNull($value, $name, $nameType, $operation) or self::checkIsNotString($value, $name, $nameType, $operation)
+ or self::checkIsEmpty($value, $name, $nameType, $operation)) {
return false;
}
return true;
@@ -55,31 +55,31 @@ public static function toString($var, $name, $operation)
return false;
}
- private static function checkIsNull($value, $name, $operation)
+ private static function checkIsNull($value, $name, $nameType, $operation)
{
if (is_null($value)) {
- SplitApp::logger()->critical($operation . ": you passed a null " . $name . ", " . $name .
+ SplitApp::logger()->critical($operation . ": you passed a null " . $name . ", " . $nameType .
" must be a non-empty string.");
return true;
}
return false;
}
- private static function checkIsEmpty($value, $name, $operation)
+ private static function checkIsEmpty($value, $name, $nameType, $operation)
{
$trimmed = trim($value);
if (empty($trimmed)) {
- SplitApp::logger()->critical($operation . ": you passed an empty " . $name . ", " . $name .
+ SplitApp::logger()->critical($operation . ": you passed an empty " . $name . ", " . $nameType .
" must be a non-empty string.");
return true;
}
return false;
}
- private static function checkIsNotString($value, $name, $operation)
+ private static function checkIsNotString($value, $name, $nameType, $operation)
{
if (!is_string($value)) {
- SplitApp::logger()->critical($operation . ": you passed an invalid " . $name . ", " . $name .
+ SplitApp::logger()->critical($operation . ": you passed an invalid " . $name . ", " . $nameType .
" must be a non-empty string.");
return true;
}
@@ -103,7 +103,7 @@ private static function checkNotProperLength($value, $name, $operation)
*/
public static function validateKey($key, $operation)
{
- if (self::checkIsNull($key, "key", $operation)) {
+ if (self::checkIsNull($key, "key", "key", $operation)) {
return null;
}
if ($key instanceof Key) {
@@ -118,7 +118,7 @@ public static function validateKey($key, $operation)
. ' key must be a non-empty string.');
return null;
}
- if (self::checkIsEmpty($strKey, "key", $operation) or self::checkNotProperLength($strKey, "key", $operation)) {
+ if (self::checkIsEmpty($strKey, "key", "key", $operation) or self::checkNotProperLength($strKey, "key", $operation)) {
return null;
}
@@ -132,7 +132,7 @@ private static function trimFeatureName($featureName, $operation = "getTreatment
{
$trimmed = trim($featureName);
if ($trimmed !== $featureName) {
- SplitApp::logger()->warning($operation . ": split name " . json_encode($featureName) . " has extra " .
+ SplitApp::logger()->warning($operation . ": featureFlagName " . json_encode($featureName) . " has extra " .
"whitespace, trimming.");
}
return $trimmed;
@@ -143,10 +143,10 @@ private static function trimFeatureName($featureName, $operation = "getTreatment
* @param $operation
* @return string|null
*/
- public static function validateFeatureName($featureName, $operation)
+ public static function validateFeatureFlagName($featureFlagName, $operation)
{
- return self::validString($featureName, 'split name', $operation) ?
- self::trimFeatureName($featureName, $operation) : null;
+ return self::validString($featureFlagName, 'featureFlagName', 'flag name', $operation) ?
+ self::trimFeatureName($featureFlagName, $operation) : null;
}
/**
@@ -155,7 +155,7 @@ public static function validateFeatureName($featureName, $operation)
*/
public static function validateTrackKey($key)
{
- if (self::checkIsNull($key, "key", "track")) {
+ if (self::checkIsNull($key, "key", "key", "track")) {
return null;
}
$strKey = self::toString($key, 'key', 'track');
@@ -163,7 +163,7 @@ public static function validateTrackKey($key)
SplitApp::logger()->critical('track: you passed an invalid key type, key must be a non-empty string.');
return null;
}
- if (self::checkIsEmpty($strKey, "key", "track") or self::checkNotProperLength($strKey, "key", "track")) {
+ if (self::checkIsEmpty($strKey, "key", "key", "track") or self::checkNotProperLength($strKey, "key", "track")) {
return null;
}
return $strKey;
@@ -175,7 +175,7 @@ public static function validateTrackKey($key)
*/
public static function validateTrafficType($trafficType)
{
- if (!self::validString($trafficType, 'traffic type', 'track')) {
+ if (!self::validString($trafficType, 'traffic type', 'traffic type', 'track')) {
return null;
}
$toLowercase = strtolower($trafficType);
@@ -198,7 +198,7 @@ public static function validateTrafficType($trafficType)
*/
public static function validateEventType($eventType)
{
- if (!self::validString($eventType, 'event type', 'track')) {
+ if (!self::validString($eventType, 'event type', 'event type', 'track')) {
return null;
}
if (!preg_match(REG_EXP_EVENT_TYPE, $eventType)) {
@@ -232,34 +232,34 @@ public static function validateValue($value)
* @param $operation
* @return array|null
*/
- public static function validateFeatureNames($featureNames, $operation)
+ public static function validateFeatureFlagNames($featureFlagNames, $operation)
{
- if (is_null($featureNames) || !is_array($featureNames)) {
- SplitApp::logger()->critical($operation . ': featureNames must be a non-empty array.');
+ if (is_null($featureFlagNames) || !is_array($featureFlagNames)) {
+ SplitApp::logger()->critical($operation . ': featureFlagNames must be a non-empty array.');
return null;
}
$filteredArray = array_values(
array_map(
- function ($featureName) use ($operation) {
- $trimmed = trim($featureName);
- if ($trimmed !== $featureName) {
- SplitApp::logger()->warning($operation . ": split name " . json_encode($featureName)
+ function ($featureFlagName) use ($operation) {
+ $trimmed = trim($featureFlagName);
+ if ($trimmed !== $featureFlagName) {
+ SplitApp::logger()->warning($operation . ": featureFlagName " . json_encode($featureFlagName)
. " has extra " . "whitespace, trimming.");
}
return $trimmed;
},
array_unique(
array_filter(
- $featureNames,
- function ($featureName) use ($operation) {
- return InputValidator::validString($featureName, 'split name', $operation);
+ $featureFlagNames,
+ function ($featureFlagName) use ($operation) {
+ return InputValidator::validString($featureFlagName, 'featureFlagName', 'flag name', $operation);
}
)
)
)
);
if (empty($filteredArray)) {
- SplitApp::logger()->critical($operation . ': featureNames must be a non-empty array.');
+ SplitApp::logger()->critical($operation . ': featureFlagNames must be a non-empty array.');
return null;
}
return $filteredArray;
@@ -344,8 +344,8 @@ public static function isSplitFound($label, $splitName, $operation)
{
if ($label == ImpressionLabel::SPLIT_NOT_FOUND) {
SplitApp::logger()->warning($operation . ": you passed " . $splitName
- . " that does not exist in this environment, please double check what Splits exist"
- . " in the web console.");
+ . " that does not exist in this environment, please double check what feature flags exist"
+ . " in the Split user interface.");
return false;
}
return true;
diff --git a/src/SplitIO/Version.php b/src/SplitIO/Version.php
index b827e7d0..a2091362 100644
--- a/src/SplitIO/Version.php
+++ b/src/SplitIO/Version.php
@@ -3,5 +3,5 @@
class Version
{
- const CURRENT = '7.1.6';
+ const CURRENT = '7.2.0-rc1';
}
diff --git a/tests/Suite/InputValidation/GetTreatmentValidationTest.php b/tests/Suite/InputValidation/GetTreatmentValidationTest.php
index 312ab2ac..9d0158e2 100644
--- a/tests/Suite/InputValidation/GetTreatmentValidationTest.php
+++ b/tests/Suite/InputValidation/GetTreatmentValidationTest.php
@@ -87,7 +87,7 @@ public function testGetTreatmentWitNumberMatchingKey()
->with($this->logicalOr(
$this->equalTo("Key: matchingKey '12345' is not of type string, converting."),
$this->equalTo("getTreatment: you passed some_feature that does not exist in this environment, "
- . "please double check what Splits exist in the web console.")
+ . "please double check what feature flags exist in the Split user interface.")
));
$this->assertEquals(
@@ -142,7 +142,7 @@ public function testGetTreatmentWitNumberBucketingKey()
->with($this->logicalOr(
$this->equalTo("Key: bucketingKey '12345' is not of type string, converting."),
$this->equalTo("getTreatment: you passed some_feature that does not exist in this environment, "
- . "please double check what Splits exist in the web console.")
+ . "please double check what feature flags exist in the Split user interface.")
));
$this->assertEquals(
@@ -217,7 +217,7 @@ public function testGetTreatmentWitNumberKey()
->with($this->logicalOr(
$this->equalTo("getTreatment: key '123456' is not of type string, converting."),
$this->equalTo("getTreatment: you passed some_feature that does not exist in this environment, "
- . "please double check what Splits exist in the web console.")
+ . "please double check what feature flags exist in the Split user interface.")
));
$this->assertEquals('control', $splitSdk->getTreatment(123456, 'some_feature'));
@@ -244,7 +244,7 @@ public function testGetTreatmentWithNullFeatureName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("getTreatment: you passed a null split name, split name must be a non-empty"
+ ->with($this->equalTo("getTreatment: you passed a null featureFlagName, flag name must be a non-empty"
. " string."));
$this->assertEquals('control', $splitSdk->getTreatment('some_key', null));
@@ -258,7 +258,7 @@ public function testGetTreatmentWithEmptyFeatureName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("getTreatment: you passed an empty split name, split name must be a non-empty"
+ ->with($this->equalTo("getTreatment: you passed an empty featureFlagName, flag name must be a non-empty"
. " string."));
$this->assertEquals('control', $splitSdk->getTreatment('some_key', ''));
@@ -272,7 +272,7 @@ public function testGetTreatmentWithNumericFeatureName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("getTreatment: you passed an invalid split name, split name must be a non-empty"
+ ->with($this->equalTo("getTreatment: you passed an invalid featureFlagName, flag name must be a non-empty"
. " string."));
$this->assertEquals('control', $splitSdk->getTreatment('some_key', 12345));
@@ -288,7 +288,7 @@ public function testGetTreatmentWithFeatureNameWithWhitespaces()
->with($this->logicalOr(
$this->equalTo("getTreatment: key '123456' is not of type string, converting."),
$this->equalTo("getTreatment: you passed some_feature that does not exist in this environment, "
- . "please double check what Splits exist in the web console.")
+ . "please double check what feature flags exist in the Split user interface.")
));
$this->assertEquals('control', $splitSdk->getTreatment("some_key", 'some_feature '));
@@ -303,7 +303,7 @@ public function testGetTreatmentWithFeatureNameWithWhitespaces2()
$logger->expects($this->any())
->method('warning')
->with($this->logicalOr(
- $this->equalTo('getTreatment: split name " some_feature " has extra whitespace, trimming.')
+ $this->equalTo('getTreatment: featureFlagName " some_feature " has extra whitespace, trimming.')
));
$this->assertEquals('control', $splitSdk->getTreatment("some_key", ' some_feature '));
@@ -317,7 +317,7 @@ public function testGetTreatmentWitBooleanFeatureName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("getTreatment: you passed an invalid split name, split name must be a non-empty"
+ ->with($this->equalTo("getTreatment: you passed an invalid featureFlagName, flag name must be a non-empty"
. " string."));
$this->assertEquals('control', $splitSdk->getTreatment('some_key', true));
@@ -331,7 +331,7 @@ public function testGetTreatmentWitArrayFeatureName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("getTreatment: you passed an invalid split name, split name must be a non-empty"
+ ->with($this->equalTo("getTreatment: you passed an invalid featureFlagName, flag name must be a non-empty"
. " string."));
$this->assertEquals('control', $splitSdk->getTreatment('some_key', array()));
@@ -346,7 +346,7 @@ public function testGetTreatmentWithNotExistantSplitName()
$logger->expects($this->once())
->method('warning')
->with($this->equalTo("getTreatment: you passed some_feature_non_existant that does not exist in this"
- . " environment, please double check what Splits exist in the web console."));
+ . " environment, please double check what feature flags exist in the Split user interface."));
$this->assertEquals('control', $splitSdk->getTreatment('some_key_non_existant', 'some_feature_non_existant'));
}
@@ -360,7 +360,7 @@ public function testGetTreatmentWithConfigWithNotExistantSplitName()
$logger->expects($this->once())
->method('warning')
->with($this->equalTo("getTreatmentWithConfig: you passed some_feature_non_existant that does"
- . " not exist in this environment, please double check what Splits exist in the web console."));
+ . " not exist in this environment, please double check what feature flags exist in the Split user interface."));
$result = $splitSdk->getTreatmentWithConfig('some_key_non_existant', 'some_feature_non_existant');
$this->assertEquals('control', $result['treatment']);
@@ -374,7 +374,7 @@ public function testGetTreatmentWitConfigWithhNullFeatureName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("getTreatmentWithConfig: you passed a null split name, split name must be a non-empty"
+ ->with($this->equalTo("getTreatmentWithConfig: you passed a null featureFlagName, flag name must be a non-empty"
. " string."));
$result = $splitSdk->getTreatmentWithConfig('some_key', null);
diff --git a/tests/Suite/InputValidation/GetTreatmentsValidationTest.php b/tests/Suite/InputValidation/GetTreatmentsValidationTest.php
index 7e8d9da6..921f36c2 100644
--- a/tests/Suite/InputValidation/GetTreatmentsValidationTest.php
+++ b/tests/Suite/InputValidation/GetTreatmentsValidationTest.php
@@ -84,7 +84,7 @@ public function testGetTreatmentsWithNumberMatchingKey()
->with($this->logicalOr(
$this->equalTo("Key: matchingKey '12345' is not of type string, converting."),
$this->equalTo("getTreatments: you passed some_feature that does not exist in this environment, "
- . "please double check what Splits exist in the web console.")
+ . "please double check what feature flags exist in the Split user interface.")
));
$treatmentResult = $splitSdk->getTreatments(new Key(12345, 'some_bucketing_key'), array('some_feature'));
@@ -135,7 +135,7 @@ public function testGetTreatmentsWitNumberBucketingKey()
->with($this->logicalOr(
$this->equalTo("Key: bucketingKey '12345' is not of type string, converting."),
$this->equalTo("getTreatments: you passed some_feature that does not exist in this environment, "
- . "please double check what Splits exist in the web console.")
+ . "please double check what feature flags exist in the Split user interface.")
));
$treatmentResult = $splitSdk->getTreatments(new Key('some_matching_key', 12345), array('some_feature'));
@@ -200,7 +200,7 @@ public function testGetTreatmentsWitNumberKey()
->with($this->logicalOr(
$this->equalTo("getTreatments: key '123456' is not of type string, converting."),
$this->equalTo("getTreatments: you passed some_feature that does not exist in this environment, "
- . "please double check what Splits exist in the web console.")
+ . "please double check what feature flags exist in the Split user interface.")
));
$treatmentResult = $splitSdk->getTreatments(123456, array('some_feature'));
@@ -251,7 +251,7 @@ public function testGetTreatmentsWithNullFeatures()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo('getTreatments: featureNames must be a non-empty array.'));
+ ->with($this->equalTo('getTreatments: featureFlagNames must be a non-empty array.'));
$this->assertEquals(array(), $splitSdk->getTreatments('some_key', null, null));
}
@@ -264,7 +264,7 @@ public function testGetTreatmentsWithFeaturesNotArray()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo('getTreatments: featureNames must be a non-empty array.'));
+ ->with($this->equalTo('getTreatments: featureFlagNames must be a non-empty array.'));
$this->assertEquals(array(), $splitSdk->getTreatments('some_key', true, null));
}
@@ -277,7 +277,7 @@ public function testGetTreatmentsWithEmptyFeatures()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo('getTreatments: featureNames must be a non-empty array.'));
+ ->with($this->equalTo('getTreatments: featureFlagNames must be a non-empty array.'));
$this->assertEquals(array(), $splitSdk->getTreatments('some_key', array(), null));
}
@@ -290,9 +290,9 @@ public function testGetTreatmentsWithNullFeaturesNames()
$logger->expects($this->exactly(3))
->method('critical')
->willReturnOnConsecutiveCalls(
- 'getTreatments: you passed a null split name, split name must be a non-empty string.',
- 'getTreatments: you passed a null split name, split name must be a non-empty string.',
- 'getTreatments: featureNames must be a non-empty array.'
+ 'getTreatments: you passed a null featureFlagName, flag name must be a non-empty string.',
+ 'getTreatments: you passed a null featureFlagName, flag name must be a non-empty string.',
+ 'getTreatments: featureFlagNames must be a non-empty array.'
);
$this->assertEquals(array(), $splitSdk->getTreatments('some_key', array(null, null), null));
}
@@ -323,9 +323,9 @@ public function testGetTreatmentsWithOneWrongTypeOfFeaturesNames()
$logger->expects($this->exactly(3))
->method('critical')
->willReturnOnConsecutiveCalls(
- 'getTreatments: you passed an invalid split name, split name must be a non-empty string.',
- 'getTreatments: you passed an invalid split name, split name must be a non-empty string',
- 'getTreatments: featureNames must be a non-empty array.'
+ 'getTreatments: you passed an invalid featureFlagName, flag name must be a non-empty string.',
+ 'getTreatments: you passed an invalid featureFlagName, flag name must be a non-empty string',
+ 'getTreatments: featureFlagNames must be a non-empty array.'
);
$this->assertEquals(array(), $splitSdk->getTreatments('some_key', array(true, array()), null));
@@ -339,9 +339,9 @@ public function testGetTreatmenstWithFeatureNameWithWhitespaces()
$logger->expects($this->any())
->method('warning')
->with($this->logicalOr(
- $this->equalTo('getTreatments: split name "some_feature " has extra whitespace, trimming.'),
+ $this->equalTo('getTreatments: featureFlagName "some_feature " has extra whitespace, trimming.'),
$this->equalTo("getTreatments: you passed some_feature that does not exist in this environment, "
- . "please double check what Splits exist in the web console.")
+ . "please double check what feature flags exist in the Split user interface.")
));
$treatmentResult = $splitSdk->getTreatments("some_key", array('some_feature '));
@@ -359,9 +359,9 @@ public function testGetTreatmenstWithFeatureNameWithWhitespaces2()
$logger->expects($this->any())
->method('warning')
->with($this->logicalOr(
- $this->equalTo('getTreatments: split name " some_feature " has extra whitespace, trimming.'),
+ $this->equalTo('getTreatments: featureFlagName " some_feature " has extra whitespace, trimming.'),
$this->equalTo("getTreatments: you passed some_feature that does not exist in this environment, "
- . "please double check what Splits exist in the web console.")
+ . "please double check what feature flags exist in the Split user interface.")
));
$treatmentResult = $splitSdk->getTreatments("some_key", array(' some_feature '));
@@ -380,7 +380,7 @@ public function testGetTreatmenstWithoutExistingFeatureName()
$logger->expects($this->once())
->method('warning')
->with($this->equalTo("getTreatments: you passed some_feature_non_existant that does"
- . " not exist in this environment, please double check what Splits exist in the web console."));
+ . " not exist in this environment, please double check what feature flags exist in the Split user interface."));
$treatmentResult = $splitSdk->getTreatments("some_key", array('some_feature_non_existant'));
@@ -398,7 +398,7 @@ public function testGetTreatmenstConfigWithoutExistingFeatureName()
$logger->expects($this->once())
->method('warning')
->with($this->equalTo("getTreatmentsWithConfig: you passed some_feature_non_existant that does"
- . " not exist in this environment, please double check what Splits exist in the web console."));
+ . " not exist in this environment, please double check what feature flags exist in the Split user interface."));
$treatmentResult = $splitSdk->getTreatmentsWithConfig("some_key", array('some_feature_non_existant'));
@@ -415,7 +415,7 @@ public function testGetTreatmenstConfigWithNullFeatures()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo('getTreatmentsWithConfig: featureNames must be a non-empty array.'));
+ ->with($this->equalTo('getTreatmentsWithConfig: featureFlagNames must be a non-empty array.'));
$treatmentResult = $splitSdk->getTreatmentsWithConfig("some_key", null);
$this->assertEquals(array(), $treatmentResult);
@@ -429,7 +429,7 @@ public function testGetTreatmenstConfigWithEmptyFeatures()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo('getTreatmentsWithConfig: featureNames must be a non-empty array.'));
+ ->with($this->equalTo('getTreatmentsWithConfig: featureFlagNames must be a non-empty array.'));
$treatmentResult = $splitSdk->getTreatmentsWithConfig("some_key", array());
$this->assertEquals(array(), $treatmentResult);
diff --git a/tests/Suite/InputValidation/ManagerValidationTest.php b/tests/Suite/InputValidation/ManagerValidationTest.php
index 77ef7bb9..7035fc1f 100644
--- a/tests/Suite/InputValidation/ManagerValidationTest.php
+++ b/tests/Suite/InputValidation/ManagerValidationTest.php
@@ -46,7 +46,7 @@ public function testManagerWithNullSplitName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("split: you passed a null split name, split name must be a non-empty string."));
+ ->with($this->equalTo("split: you passed a null featureFlagName, flag name must be a non-empty string."));
$this->assertEquals(null, $splitSdk->split(null));
}
@@ -59,7 +59,7 @@ public function testManagerWithEmptySplitName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("split: you passed an empty split name, split name must be a non-empty string."));
+ ->with($this->equalTo("split: you passed an empty featureFlagName, flag name must be a non-empty string."));
$this->assertEquals(null, $splitSdk->split(''));
}
@@ -72,7 +72,7 @@ public function testManagerWithBooleanSplitName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("split: you passed an invalid split name, split name must be a non-empty string."));
+ ->with($this->equalTo("split: you passed an invalid featureFlagName, flag name must be a non-empty string."));
$this->assertEquals(null, $splitSdk->split(true));
}
@@ -85,7 +85,7 @@ public function testManagerWithArraySplitName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("split: you passed an invalid split name, split name must be a non-empty string."));
+ ->with($this->equalTo("split: you passed an invalid featureFlagName, flag name must be a non-empty string."));
$this->assertEquals(null, $splitSdk->split(array()));
}
@@ -98,7 +98,7 @@ public function testManagerWithNumberSplitName()
$logger->expects($this->once())
->method('critical')
- ->with($this->equalTo("split: you passed an invalid split name, split name must be a non-empty string."));
+ ->with($this->equalTo("split: you passed an invalid featureFlagName, flag name must be a non-empty string."));
$this->assertEquals(null, $splitSdk->split(1));
}
@@ -112,7 +112,7 @@ public function testManagerWithValidFeatureName()
$logger->expects($this->once())
->method('warning')
->with($this->equalTo("split: you passed this_is_a_non_existing_split that does"
- . " not exist in this environment, please double check what Splits exist in the web console."));
+ . " not exist in this environment, please double check what feature flags exist in the Split user interface."));
$this->assertEquals(null, $splitSdk->split('this_is_a_non_existing_split'));
}
diff --git a/tests/Suite/Sdk/SdkClientTest.php b/tests/Suite/Sdk/SdkClientTest.php
index a26ab3fa..12c3dcfa 100644
--- a/tests/Suite/Sdk/SdkClientTest.php
+++ b/tests/Suite/Sdk/SdkClientTest.php
@@ -337,7 +337,7 @@ public function testClient()
$this->assertEquals('on', $result['all_feature']);
$this->validateLastImpression($redisClient, 'all_feature', 'invalidKey', 'on');
- //testing multiple splitNames
+ //testing multiple featureFlags
$result = $splitSdk->getTreatments('invalidKey', array(
'all_feature',
'killed_feature',
@@ -388,7 +388,7 @@ public function testClient()
$this->assertEquals(null, $result['all_feature']['config']);
$this->validateLastImpression($redisClient, 'all_feature', 'invalidKey', 'on');
- //testing multiple splitNames
+ //testing multiple featureFlags
$result = $splitSdk->getTreatmentsWithConfig('invalidKey', array(
'all_feature',
'killed_feature',