Skip to content

Commit 1a56c48

Browse files
authored
Merge pull request #146 from splitio/develop
Develop
2 parents 682faf4 + 5b34d0d commit 1a56c48

File tree

4 files changed

+128
-180
lines changed

4 files changed

+128
-180
lines changed

src/SplitIO/Sdk/Client.php

Lines changed: 6 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -168,37 +168,7 @@ private function doEvaluation($operation, $metricName, $key, $featureName, $attr
168168
}
169169

170170
/**
171-
* Returns the treatment to show this id for this feature.
172-
* The set of treatments for a feature can be configured
173-
* on the Split web console.
174-
* This method returns the string 'control' if:
175-
* <ol>
176-
* <li>Any of the parameters were null</li>
177-
* <li>There was an exception</li>
178-
* <li>The SDK does not know this feature</li>
179-
* <li>The feature was deleted through the web console.</li>
180-
* </ol>
181-
* 'control' is a reserved treatment, to highlight these
182-
* exceptional circumstances.
183-
*
184-
* <p>
185-
* The sdk returns the default treatment of this feature if:
186-
* <ol>
187-
* <li>The feature was killed</li>
188-
* <li>The id did not match any of the conditions in the
189-
* feature roll-out plan</li>
190-
* </ol>
191-
* The default treatment of a feature is set on the Split web
192-
* console.
193-
*
194-
* <p>
195-
* This method does not throw any exceptions.
196-
* It also never returns null.
197-
*
198-
* @param $key
199-
* @param $featureName
200-
* @param $attributes
201-
* @return string
171+
* @inheritdoc
202172
*/
203173
public function getTreatment($key, $featureName, array $attributes = null)
204174
{
@@ -218,42 +188,7 @@ public function getTreatment($key, $featureName, array $attributes = null)
218188
}
219189

220190
/**
221-
* Returns an object with the treatment to show this id for this feature
222-
* and the config provided.
223-
* The set of treatments and config for a feature can be configured
224-
* on the Split web console.
225-
* This method returns the string 'control' if:
226-
* <ol>
227-
* <li>Any of the parameters were null</li>
228-
* <li>There was an exception</li>
229-
* <li>The SDK does not know this feature</li>
230-
* <li>The feature was deleted through the web console.</li>
231-
* </ol>
232-
* 'control' is a reserved treatment, to highlight these
233-
* exceptional circumstances.
234-
*
235-
* <p>
236-
* The sdk returns the default treatment of this feature if:
237-
* <ol>
238-
* <li>The feature was killed</li>
239-
* <li>The id did not match any of the conditions in the
240-
* feature roll-out plan</li>
241-
* </ol>
242-
* The default treatment of a feature is set on the Split web
243-
* console.
244-
*
245-
* <p>
246-
* This method does not throw any exceptions.
247-
* It also never returns null.
248-
*
249-
* This method returns null configuration if:
250-
* <ol>
251-
* <li>config was not set up</li>
252-
* </ol>
253-
* @param $key
254-
* @param $featureName
255-
* @param $attributes
256-
* @return string
191+
* @inheritdoc
257192
*/
258193
public function getTreatmentWithConfig($key, $featureName, array $attributes = null)
259194
{
@@ -388,35 +323,7 @@ private function doEvaluationForTreatments($operation, $metricName, $key, $featu
388323
}
389324

390325
/**
391-
* Returns an associative array which each key will be
392-
* the treatment result for each feature passed as parameter.
393-
* The set of treatments for a feature can be configured
394-
* on the Split web console.
395-
* This method returns the string 'control' if:
396-
* <ol>
397-
* <li>featureNames is invalid/li>
398-
* </ol>
399-
* 'control' is a reserved treatment, to highlight these
400-
* exceptional circumstances.
401-
*
402-
* <p>
403-
* The sdk returns the default treatment of this feature if:
404-
* <ol>
405-
* <li>The feature was killed</li>
406-
* <li>The id did not match any of the conditions in the
407-
* feature roll-out plan</li>
408-
* </ol>
409-
* The default treatment of a feature is set on the Split web
410-
* console.
411-
*
412-
* <p>
413-
* This method does not throw any exceptions.
414-
* It also never returns null.
415-
*
416-
* @param $key
417-
* @param $featureNames
418-
* @param $attributes
419-
* @return array|control
326+
* @inheritdoc
420327
*/
421328
public function getTreatments($key, $featureNames, array $attributes = null)
422329
{
@@ -434,44 +341,14 @@ function ($feature) {
434341
)
435342
);
436343
} catch (\Exception $e) {
437-
SplitApp::logger()->critical('getTreatmens method is throwing exceptions');
344+
SplitApp::logger()->critical('getTreatments method is throwing exceptions');
438345
$splitNames = InputValidator::validateFeatureNames($featureNames, 'getTreatments');
439346
return is_null($splitNames) ? array() : array_fill_keys($splitNames, TreatmentEnum::CONTROL);
440347
}
441348
}
442349

443350
/**
444-
* Returns an associative array which each key will be
445-
* the treatment result and the config for each
446-
* feature passed as parameter.
447-
* The set of treatments for a feature can be configured
448-
* on the Split web console and the config for
449-
* that treatment.
450-
* This method returns the string 'control' if:
451-
* <ol>
452-
* <li>featureNames is invalid/li>
453-
* </ol>
454-
* 'control' is a reserved treatment, to highlight these
455-
* exceptional circumstances.
456-
*
457-
* <p>
458-
* The sdk returns the default treatment of this feature if:
459-
* <ol>
460-
* <li>The feature was killed</li>
461-
* <li>The id did not match any of the conditions in the
462-
* feature roll-out plan</li>
463-
* </ol>
464-
* The default treatment of a feature is set on the Split web
465-
* console.
466-
*
467-
* <p>
468-
* This method does not throw any exceptions.
469-
* It also never returns null.
470-
*
471-
* @param $key
472-
* @param $featureNames
473-
* @param $attributes
474-
* @return array|control
351+
* @inheritdoc
475352
*/
476353
public function getTreatmentsWithConfig($key, $featureNames, array $attributes = null)
477354
{
@@ -492,18 +369,7 @@ public function getTreatmentsWithConfig($key, $featureNames, array $attributes =
492369
}
493370

494371
/**
495-
* A short-hand for
496-
* <pre>
497-
* (getTreatment(key, feature) == treatment) ? true : false;
498-
* </pre>
499-
*
500-
* This method never throws exceptions.
501-
* Instead of throwing exceptions, it returns false.
502-
*
503-
* @param $key
504-
* @param $featureName
505-
* @param $treatment
506-
* @return bool
372+
* @inheritdoc
507373
*/
508374
public function isTreatment($key, $featureName, $treatment)
509375
{

src/SplitIO/Sdk/ClientInterface.php

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,114 @@ interface ClientInterface
3838
*/
3939
public function getTreatment($key, $featureName, array $attributes = null);
4040

41+
/**
42+
* Returns an object with the treatment to show this id for this feature
43+
* and the config provided.
44+
* The set of treatments and config for a feature can be configured
45+
* on the Split web console.
46+
* This method returns the string 'control' if:
47+
* <ol>
48+
* <li>Any of the parameters were null</li>
49+
* <li>There was an exception</li>
50+
* <li>The SDK does not know this feature</li>
51+
* <li>The feature was deleted through the web console.</li>
52+
* </ol>
53+
* 'control' is a reserved treatment, to highlight these
54+
* exceptional circumstances.
55+
*
56+
* <p>
57+
* The sdk returns the default treatment of this feature if:
58+
* <ol>
59+
* <li>The feature was killed</li>
60+
* <li>The id did not match any of the conditions in the
61+
* feature roll-out plan</li>
62+
* </ol>
63+
* The default treatment of a feature is set on the Split web
64+
* console.
65+
*
66+
* <p>
67+
* This method does not throw any exceptions.
68+
* It also never returns null.
69+
*
70+
* This method returns null configuration if:
71+
* <ol>
72+
* <li>config was not set up</li>
73+
* </ol>
74+
* @param $key
75+
* @param $featureName
76+
* @param $attributes
77+
* @return string
78+
*/
79+
public function getTreatmentWithConfig($key, $featureName, array $attributes = null);
80+
81+
/**
82+
* Returns an associative array which each key will be
83+
* the treatment result for each feature passed as parameter.
84+
* The set of treatments for a feature can be configured
85+
* on the Split web console.
86+
* This method returns the string 'control' if:
87+
* <ol>
88+
* <li>featureNames is invalid/li>
89+
* </ol>
90+
* 'control' is a reserved treatment, to highlight these
91+
* exceptional circumstances.
92+
*
93+
* <p>
94+
* The sdk returns the default treatment of this feature if:
95+
* <ol>
96+
* <li>The feature was killed</li>
97+
* <li>The id did not match any of the conditions in the
98+
* feature roll-out plan</li>
99+
* </ol>
100+
* The default treatment of a feature is set on the Split web
101+
* console.
102+
*
103+
* <p>
104+
* This method does not throw any exceptions.
105+
* It also never returns null.
106+
*
107+
* @param $key
108+
* @param $featureNames
109+
* @param $attributes
110+
* @return array
111+
*/
112+
public function getTreatments($key, $featureNames, array $attributes = null);
113+
114+
/**
115+
* Returns an associative array which each key will be
116+
* the treatment result and the config for each
117+
* feature passed as parameter.
118+
* The set of treatments for a feature can be configured
119+
* on the Split web console and the config for
120+
* that treatment.
121+
* This method returns the string 'control' if:
122+
* <ol>
123+
* <li>featureNames is invalid/li>
124+
* </ol>
125+
* 'control' is a reserved treatment, to highlight these
126+
* exceptional circumstances.
127+
*
128+
* <p>
129+
* The sdk returns the default treatment of this feature if:
130+
* <ol>
131+
* <li>The feature was killed</li>
132+
* <li>The id did not match any of the conditions in the
133+
* feature roll-out plan</li>
134+
* </ol>
135+
* The default treatment of a feature is set on the Split web
136+
* console.
137+
*
138+
* <p>
139+
* This method does not throw any exceptions.
140+
* It also never returns null.
141+
*
142+
* @param $key
143+
* @param $featureNames
144+
* @param $attributes
145+
* @return array
146+
*/
147+
public function getTreatmentsWithConfig($key, $featureNames, array $attributes = null);
148+
41149
/**
42150
* A short-hand for
43151
* <pre>

src/SplitIO/Sdk/LocalhostClient.php

Lines changed: 13 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -134,36 +134,7 @@ public function doValidation($key, $featureName, $operation)
134134
}
135135

136136
/**
137-
* Returns the treatment to show this id for this feature.
138-
* The set of treatments for a feature can be configured
139-
* on the Split web console.
140-
* This method returns the string 'control' if:
141-
* <ol>
142-
* <li>Any of the parameters were null</li>
143-
* <li>There was an exception</li>
144-
* <li>The SDK does not know this feature</li>
145-
* <li>The feature was deleted through the web console.</li>
146-
* </ol>
147-
* 'control' is a reserved treatment, to highlight these
148-
* exceptional circumstances.
149-
*
150-
* <p>
151-
* The sdk returns the default treatment of this feature if:
152-
* <ol>
153-
* <li>The feature was killed</li>
154-
* <li>The id did not match any of the conditions in the
155-
* feature roll-out plan</li>
156-
* </ol>
157-
* The default treatment of a feature is set on the Split web
158-
* console.
159-
*
160-
* <p>
161-
* This method does not throw any exceptions.
162-
* It also never returns null.
163-
*
164-
* @param $key
165-
* @param $featureName
166-
* @return string
137+
* @inheritdoc
167138
*/
168139
public function getTreatment($key, $featureName, array $attributes = null)
169140
{
@@ -183,6 +154,9 @@ public function getTreatment($key, $featureName, array $attributes = null)
183154
return TreatmentEnum::CONTROL;
184155
}
185156

157+
/**
158+
* @inheritdoc
159+
*/
186160
public function getTreatmentWithConfig($key, $featureName, array $attributes = null)
187161
{
188162
$treatmentResult = array(
@@ -212,7 +186,10 @@ public function getTreatmentWithConfig($key, $featureName, array $attributes = n
212186
return $treatmentResult;
213187
}
214188

215-
public function getTreatments($key, $featureNames, $attributes = null)
189+
/**
190+
* @inheritdoc
191+
*/
192+
public function getTreatments($key, $featureNames, array $attributes = null)
216193
{
217194
$splitNames = InputValidator::validateFeatureNames($featureNames, "getTreatments");
218195
if (is_null($splitNames)) {
@@ -233,7 +210,10 @@ public function getTreatments($key, $featureNames, $attributes = null)
233210
return $result;
234211
}
235212

236-
public function getTreatmentsWithConfig($key, $featureNames, $attributes = null)
213+
/**
214+
* @inheritdoc
215+
*/
216+
public function getTreatmentsWithConfig($key, $featureNames, array $attributes = null)
237217
{
238218
$splitNames = InputValidator::validateFeatureNames($featureNames, "getTreatmentsWithConfig");
239219
if (is_null($splitNames)) {
@@ -255,13 +235,7 @@ public function getTreatmentsWithConfig($key, $featureNames, $attributes = null)
255235
}
256236

257237
/**
258-
* This method never throws exceptions.
259-
* Instead of throwing exceptions, it returns false.
260-
*
261-
* @param $key
262-
* @param $featureName
263-
* @param $treatment
264-
* @return bool
238+
* @inheritdoc
265239
*/
266240
public function isTreatment($key, $featureName, $treatment)
267241
{

src/SplitIO/Version.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33

44
class Version
55
{
6-
const CURRENT = '6.2.3';
6+
const CURRENT = '6.2.4';
77
}

0 commit comments

Comments
 (0)