diff --git a/src/SplitIO/Sdk/Client.php b/src/SplitIO/Sdk/Client.php index 2a1581c7..fbc9a767 100644 --- a/src/SplitIO/Sdk/Client.php +++ b/src/SplitIO/Sdk/Client.php @@ -168,37 +168,7 @@ private function doEvaluation($operation, $metricName, $key, $featureName, $attr } /** - * 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. - * This method returns the string 'control' if: - *
- * The sdk returns the default treatment of this feature if: - *
- * This method does not throw any exceptions. - * It also never returns null. - * - * @param $key - * @param $featureName - * @param $attributes - * @return string + * @inheritdoc */ public function getTreatment($key, $featureName, array $attributes = null) { @@ -218,42 +188,7 @@ public function getTreatment($key, $featureName, 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. - * This method returns the string 'control' if: - *
- * The sdk returns the default treatment of this feature if: - *
- * This method does not throw any exceptions. - * It also never returns null. - * - * This method returns null configuration if: - *
- * The sdk returns the default treatment of this feature if: - *
- * This method does not throw any exceptions. - * It also never returns null. - * - * @param $key - * @param $featureNames - * @param $attributes - * @return array|control + * @inheritdoc */ public function getTreatments($key, $featureNames, array $attributes = null) { @@ -434,44 +341,14 @@ function ($feature) { ) ); } catch (\Exception $e) { - SplitApp::logger()->critical('getTreatmens method is throwing exceptions'); + SplitApp::logger()->critical('getTreatments method is throwing exceptions'); $splitNames = InputValidator::validateFeatureNames($featureNames, 'getTreatments'); return is_null($splitNames) ? array() : array_fill_keys($splitNames, TreatmentEnum::CONTROL); } } /** - * 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 - * that treatment. - * This method returns the string 'control' if: - *
- * The sdk returns the default treatment of this feature if: - *
- * This method does not throw any exceptions. - * It also never returns null. - * - * @param $key - * @param $featureNames - * @param $attributes - * @return array|control + * @inheritdoc */ public function getTreatmentsWithConfig($key, $featureNames, array $attributes = null) { @@ -492,18 +369,7 @@ public function getTreatmentsWithConfig($key, $featureNames, array $attributes = } /** - * A short-hand for - *
- * (getTreatment(key, feature) == treatment) ? true : false; - *- * - * This method never throws exceptions. - * Instead of throwing exceptions, it returns false. - * - * @param $key - * @param $featureName - * @param $treatment - * @return bool + * @inheritdoc */ public function isTreatment($key, $featureName, $treatment) { diff --git a/src/SplitIO/Sdk/ClientInterface.php b/src/SplitIO/Sdk/ClientInterface.php index 4ee239a3..e4fbe4e6 100644 --- a/src/SplitIO/Sdk/ClientInterface.php +++ b/src/SplitIO/Sdk/ClientInterface.php @@ -38,6 +38,114 @@ interface ClientInterface */ public function getTreatment($key, $featureName, 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. + * This method returns the string 'control' if: + *
+ * The sdk returns the default treatment of this feature if: + *
+ * This method does not throw any exceptions. + * It also never returns null. + * + * This method returns null configuration if: + *
+ * The sdk returns the default treatment of this feature if: + *
+ * This method does not throw any exceptions. + * It also never returns null. + * + * @param $key + * @param $featureNames + * @param $attributes + * @return array + */ + public function getTreatments($key, $featureNames, 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 + * that treatment. + * This method returns the string 'control' if: + *
+ * The sdk returns the default treatment of this feature if: + *
+ * This method does not throw any exceptions. + * It also never returns null. + * + * @param $key + * @param $featureNames + * @param $attributes + * @return array + */ + public function getTreatmentsWithConfig($key, $featureNames, array $attributes = null); + /** * A short-hand for *
diff --git a/src/SplitIO/Sdk/LocalhostClient.php b/src/SplitIO/Sdk/LocalhostClient.php index ec27c0c4..7a8b51a4 100644 --- a/src/SplitIO/Sdk/LocalhostClient.php +++ b/src/SplitIO/Sdk/LocalhostClient.php @@ -134,36 +134,7 @@ public function doValidation($key, $featureName, $operation) } /** - * 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. - * This method returns the string 'control' if: - *- *
- * 'control' is a reserved treatment, to highlight these - * exceptional circumstances. - * - *- Any of the parameters were null
- *- There was an exception
- *- The SDK does not know this feature
- *- The feature was deleted through the web console.
- *- * The sdk returns the default treatment of this feature if: - *
- *
- * The default treatment of a feature is set on the Split web - * console. - * - *- The feature was killed
- *- The id did not match any of the conditions in the - * feature roll-out plan
- *- * This method does not throw any exceptions. - * It also never returns null. - * - * @param $key - * @param $featureName - * @return string + * @inheritdoc */ public function getTreatment($key, $featureName, array $attributes = null) { @@ -183,6 +154,9 @@ public function getTreatment($key, $featureName, array $attributes = null) return TreatmentEnum::CONTROL; } + /** + * @inheritdoc + */ public function getTreatmentWithConfig($key, $featureName, array $attributes = null) { $treatmentResult = array( @@ -212,7 +186,10 @@ public function getTreatmentWithConfig($key, $featureName, array $attributes = n return $treatmentResult; } - public function getTreatments($key, $featureNames, $attributes = null) + /** + * @inheritdoc + */ + public function getTreatments($key, $featureNames, array $attributes = null) { $splitNames = InputValidator::validateFeatureNames($featureNames, "getTreatments"); if (is_null($splitNames)) { @@ -233,7 +210,10 @@ public function getTreatments($key, $featureNames, $attributes = null) return $result; } - public function getTreatmentsWithConfig($key, $featureNames, $attributes = null) + /** + * @inheritdoc + */ + public function getTreatmentsWithConfig($key, $featureNames, array $attributes = null) { $splitNames = InputValidator::validateFeatureNames($featureNames, "getTreatmentsWithConfig"); if (is_null($splitNames)) { @@ -255,13 +235,7 @@ public function getTreatmentsWithConfig($key, $featureNames, $attributes = null) } /** - * This method never throws exceptions. - * Instead of throwing exceptions, it returns false. - * - * @param $key - * @param $featureName - * @param $treatment - * @return bool + * @inheritdoc */ public function isTreatment($key, $featureName, $treatment) { diff --git a/src/SplitIO/Version.php b/src/SplitIO/Version.php index 4b8ef846..ed041db8 100644 --- a/src/SplitIO/Version.php +++ b/src/SplitIO/Version.php @@ -3,5 +3,5 @@ class Version { - const CURRENT = '6.2.3'; + const CURRENT = '6.2.4'; }