Skip to content

Commit e9d9de1

Browse files
committed
✏️ nits addressed
1 parent c0e0d4b commit e9d9de1

File tree

6 files changed

+18
-20
lines changed

6 files changed

+18
-20
lines changed

src/Optimizely/Entity/Variation.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct($id = null, $key = null, $variableUsageInstances = [
5050
$this->_id = $id;
5151
$this->_key = $key;
5252

53-
$this->_variableUsageInstances = ConfigParser::generateMap($variableUsageInstances,null,VariableUsage::class);
53+
$this->_variableUsageInstances = ConfigParser::generateMap($variableUsageInstances, null, VariableUsage::class);
5454

5555
if(!empty($this->_variableUsageInstances)){
5656
foreach(array_values($this->_variableUsageInstances) as $variableUsage){
@@ -96,7 +96,7 @@ public function getVariables(){
9696
}
9797

9898
public function setVariables($variableUsageInstances){
99-
$this->_variableUsageInstances = ConfigParser::generateMap($variableUsageInstances,null,VariableUsage::class);
99+
$this->_variableUsageInstances = ConfigParser::generateMap($variableUsageInstances, null , VariableUsage::class);
100100

101101
if(!empty($this->_variableUsageInstances)){
102102
foreach(array_values($this->_variableUsageInstances) as $variableUsage){

src/Optimizely/Event/Builder/Params.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@
2323
define('REVISION', 'revision');
2424
define('EXPERIMENT_ID', 'experiment_id');
2525
define('VARIATION_ID', 'variation_id');
26-
define('CAMPAIGN_ID','campaign_id');
26+
define('CAMPAIGN_ID', 'campaign_id');
2727
define('VISITOR_ID', 'visitor_id');
2828
define('DECISIONS', 'decisions');
2929
define('EVENTS', 'events');;
3030
define('CLIENT_ENGINE', 'client_name');
3131
define('CLIENT_VERSION', 'client_version');
3232
define('CUSTOM_ATTRIBUTE_FEATURE_TYPE','custom');
33-
define('ACTIVATE_EVENT_KEY','campaign_activated');
34-
define('SNAPSHOTS','snapshots');
33+
define('ACTIVATE_EVENT_KEY', 'campaign_activated');
34+
define('SNAPSHOTS', 'snapshots');
3535
define('ATTRIBUTES', 'attributes');
3636
define('KEY', 'key');
3737
define('TYPE', 'type');

src/Optimizely/ProjectConfig.php

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ public function getExperimentFromId($experimentId)
309309
}
310310

311311
/**
312-
* @param String $featureKey
313-
* @return FeatureFlag
312+
* @param String $featureKey Key of the feature flag
313+
* @return FeatureFlag Entity corresponding to the key.
314314
*/
315315
public function getFeatureFlagFromKey($featureKey)
316316
{
@@ -326,7 +326,6 @@ public function getFeatureFlagFromKey($featureKey)
326326
/**
327327
* @param String $rolloutId
328328
* @return Rollout
329-
*
330329
*/
331330
public function getRolloutFromId($rolloutId)
332331
{

src/Optimizely/Utils/EventTagUtils.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -65,30 +65,30 @@ public static function getNumericValue($eventTags, LoggerInterface $logger = nul
6565

6666
if (!$eventTags) {
6767
if($logger)
68-
$logger->log(Logger::DEBUG,"Event tags is undefined.");
68+
$logger->log(Logger::DEBUG, "Event tags is undefined.");
6969
return null;
7070
} else if (!is_array($eventTags)) {
7171
if($logger)
72-
$logger->log(Logger::DEBUG,"Event tags is not a dictionary.");
72+
$logger->log(Logger::DEBUG, "Event tags is not a dictionary.");
7373
return null;
7474
} else if (!isset($eventTags[self::NUMERIC_EVENT_METRIC_NAME])) {
7575
if($logger)
76-
$logger->log(Logger::DEBUG,"The numeric metric key is not defined in the event tags or is null.");
76+
$logger->log(Logger::DEBUG, "The numeric metric key is not defined in the event tags or is null.");
7777
return null;
7878
} else if (!is_numeric($eventTags[self::NUMERIC_EVENT_METRIC_NAME])) {
7979
if($logger)
80-
$logger->log(Logger::DEBUG,"Numeric metric value is not an integer or float, or is not a numeric string.");
80+
$logger->log(Logger::DEBUG, "Numeric metric value is not an integer or float, or is not a numeric string.");
8181
return null;
8282
} else if(is_nan($eventTags[self::NUMERIC_EVENT_METRIC_NAME]) || is_infinite(floatval($eventTags[self::NUMERIC_EVENT_METRIC_NAME]))){
8383
if($logger)
84-
$logger->log(Logger::DEBUG,"Provided numeric value is in an invalid format.");
84+
$logger->log(Logger::DEBUG, "Provided numeric value is in an invalid format.");
8585
return null;
8686
}
8787

8888
$rawValue = $eventTags[self::NUMERIC_EVENT_METRIC_NAME];
8989
// # Log the final numeric metric value
9090
if($logger){
91-
$logger->log(Logger::INFO,"The numeric metric value {$rawValue} will be sent to results.");
91+
$logger->log(Logger::INFO, "The numeric metric value {$rawValue} will be sent to results.");
9292
}
9393

9494
return floatval($rawValue);

src/Optimizely/Utils/Validator.php

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
namespace Optimizely\Utils;
1818

1919
use JsonSchema;
20+
use Monolog\Logger;
2021
use Optimizely\Entity\Experiment;
21-
use Optimizely\ProjectConfig;
2222
use Optimizely\Logger\LoggerInterface;
23-
use Monolog\Logger;
24-
23+
use Optimizely\ProjectConfig;
2524

2625
class Validator
2726
{
@@ -42,9 +41,9 @@ public static function validateJsonSchema($datafile, LoggerInterface $logger = n
4241
return true;
4342
} else {
4443
if($logger){
45-
$logger->log(Logger::DEBUG,"JSON does not validate. Violations:\n");;
44+
$logger->log(Logger::DEBUG, "JSON does not validate. Violations:\n");;
4645
foreach ($validator->getErrors() as $error) {
47-
$logger->log(Logger::DEBUG,"[%s] %s\n", $error['property'], $error['message']);
46+
$logger->log(Logger::DEBUG, "[%s] %s\n", $error['property'], $error['message']);
4847
}
4948
}
5049

tests/DecisionServiceTests/DecisionServiceTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public function testGetVariationReturnsWhitelistedVariation()
139139

140140
public function testGetVariationReturnsWhitelistedVariationForGroupedExperiment()
141141
{
142-
$expectedVariation = new Variation('7722260071', 'group_exp_1_var_1',[
142+
$expectedVariation = new Variation('7722260071', 'group_exp_1_var_1', [
143143
[
144144
"id" => "155563",
145145
"value" => "groupie_1_v1"

0 commit comments

Comments
 (0)