2525use Optimizely \DecisionService \FeatureDecision ;
2626use Optimizely \Entity \Experiment ;
2727use Optimizely \Entity \FeatureVariable ;
28- use Optimizely \Logger \DefaultLogger ;
2928use Optimizely \ErrorHandler \ErrorHandlerInterface ;
3029use Optimizely \ErrorHandler \NoOpErrorHandler ;
3130use Optimizely \Event \Builder \EventBuilder ;
3231use Optimizely \Event \Dispatcher \DefaultEventDispatcher ;
3332use Optimizely \Event \Dispatcher \EventDispatcherInterface ;
33+ use Optimizely \Logger \DefaultLogger ;
3434use Optimizely \Logger \LoggerInterface ;
3535use Optimizely \Logger \NoOpLogger ;
3636use Optimizely \Notification \NotificationCenter ;
@@ -479,18 +479,18 @@ public function isFeatureEnabled($featureFlagKey, $userId, $attributes = null)
479479 return false ;
480480 }
481481
482- $ feature_flag = $ this ->_config ->getFeatureFlagFromKey ($ featureFlagKey );
483- if ($ feature_flag && (!$ feature_flag ->getId ())) {
482+ $ featureFlag = $ this ->_config ->getFeatureFlagFromKey ($ featureFlagKey );
483+ if ($ featureFlag && (!$ featureFlag ->getId ())) {
484484 // Error logged in ProjectConfig - getFeatureFlagFromKey
485485 return false ;
486486 }
487487
488488 //validate feature flag
489- if (!Validator::isFeatureFlagValid ($ this ->_config , $ feature_flag )) {
489+ if (!Validator::isFeatureFlagValid ($ this ->_config , $ featureFlag )) {
490490 return false ;
491491 }
492492
493- $ decision = $ this ->_decisionService ->getVariationForFeature ($ feature_flag , $ userId , $ attributes );
493+ $ decision = $ this ->_decisionService ->getVariationForFeature ($ featureFlag , $ userId , $ attributes );
494494 if (!$ decision ) {
495495 $ this ->_logger ->log (Logger::INFO , "Feature Flag ' {$ featureFlagKey }' is not enabled for user ' {$ userId }'. " );
496496 return false ;
@@ -574,8 +574,8 @@ public function getFeatureVariableValueForType(
574574 return null ;
575575 }
576576
577- $ feature_flag = $ this ->_config ->getFeatureFlagFromKey ($ featureFlagKey );
578- if ($ feature_flag && (!$ feature_flag ->getId ())) {
577+ $ featureFlag = $ this ->_config ->getFeatureFlagFromKey ($ featureFlagKey );
578+ if ($ featureFlag && (!$ featureFlag ->getId ())) {
579579 // Error logged in ProjectConfig - getFeatureFlagFromKey
580580 return null ;
581581 }
@@ -594,35 +594,35 @@ public function getFeatureVariableValueForType(
594594 return null ;
595595 }
596596
597- $ decision = $ this ->_decisionService ->getVariationForFeature ($ feature_flag , $ userId , $ attributes );
598- $ variable_value = $ variable ->getDefaultValue ();
597+ $ decision = $ this ->_decisionService ->getVariationForFeature ($ featureFlag , $ userId , $ attributes );
598+ $ variableValue = $ variable ->getDefaultValue ();
599599
600600 if (!$ decision ) {
601601 $ this ->_logger ->log (
602602 Logger::INFO ,
603603 "User ' {$ userId }'is not in any variation, " .
604- "returning default value ' {$ variable_value }'. "
604+ "returning default value ' {$ variableValue }'. "
605605 );
606606 } else {
607607 $ variation = $ decision ->getVariation ();
608608 $ variable_usage = $ variation ->getVariableUsageById ($ variable ->getId ());
609609 if ($ variable_usage ) {
610- $ variable_value = $ variable_usage ->getValue ();
610+ $ variableValue = $ variable_usage ->getValue ();
611611 $ this ->_logger ->log (
612612 Logger::INFO ,
613- "Returning variable value ' {$ variable_value }' for variation ' {$ variation ->getKey ()}' " .
613+ "Returning variable value ' {$ variableValue }' for variation ' {$ variation ->getKey ()}' " .
614614 "of feature flag ' {$ featureFlagKey }' "
615615 );
616616 } else {
617617 $ this ->_logger ->log (
618618 Logger::INFO ,
619619 "Variable ' {$ variableKey }' is not used in variation ' {$ variation ->getKey ()}', " .
620- "returning default value ' {$ variable_value }'. "
620+ "returning default value ' {$ variableValue }'. "
621621 );
622622 }
623623 }
624624
625- return $ variable_value ;
625+ return $ variableValue ;
626626 }
627627
628628 /**
@@ -637,19 +637,19 @@ public function getFeatureVariableValueForType(
637637 */
638638 public function getFeatureVariableBoolean ($ featureFlagKey , $ variableKey , $ userId , $ attributes = null )
639639 {
640- $ variable_value = $ this ->getFeatureVariableValueForType (
640+ $ variableValue = $ this ->getFeatureVariableValueForType (
641641 $ featureFlagKey ,
642642 $ variableKey ,
643643 $ userId ,
644644 $ attributes ,
645645 FeatureVariable::BOOLEAN_TYPE
646646 );
647647
648- if (!is_null ($ variable_value )) {
649- return VariableTypeUtils::castStringToType ($ variable_value , FeatureVariable::BOOLEAN_TYPE , $ this ->_logger );
648+ if (!is_null ($ variableValue )) {
649+ return VariableTypeUtils::castStringToType ($ variableValue , FeatureVariable::BOOLEAN_TYPE , $ this ->_logger );
650650 }
651651
652- return $ variable_value ;
652+ return $ variableValue ;
653653 }
654654
655655 /**
@@ -664,19 +664,19 @@ public function getFeatureVariableBoolean($featureFlagKey, $variableKey, $userId
664664 */
665665 public function getFeatureVariableInteger ($ featureFlagKey , $ variableKey , $ userId , $ attributes = null )
666666 {
667- $ variable_value = $ this ->getFeatureVariableValueForType (
667+ $ variableValue = $ this ->getFeatureVariableValueForType (
668668 $ featureFlagKey ,
669669 $ variableKey ,
670670 $ userId ,
671671 $ attributes ,
672672 FeatureVariable::INTEGER_TYPE
673673 );
674674
675- if (!is_null ($ variable_value )) {
676- return VariableTypeUtils::castStringToType ($ variable_value , FeatureVariable::INTEGER_TYPE , $ this ->_logger );
675+ if (!is_null ($ variableValue )) {
676+ return VariableTypeUtils::castStringToType ($ variableValue , FeatureVariable::INTEGER_TYPE , $ this ->_logger );
677677 }
678678
679- return $ variable_value ;
679+ return $ variableValue ;
680680 }
681681
682682 /**
@@ -691,19 +691,19 @@ public function getFeatureVariableInteger($featureFlagKey, $variableKey, $userId
691691 */
692692 public function getFeatureVariableDouble ($ featureFlagKey , $ variableKey , $ userId , $ attributes = null )
693693 {
694- $ variable_value = $ this ->getFeatureVariableValueForType (
694+ $ variableValue = $ this ->getFeatureVariableValueForType (
695695 $ featureFlagKey ,
696696 $ variableKey ,
697697 $ userId ,
698698 $ attributes ,
699699 FeatureVariable::DOUBLE_TYPE
700700 );
701701
702- if (!is_null ($ variable_value )) {
703- return VariableTypeUtils::castStringToType ($ variable_value , FeatureVariable::DOUBLE_TYPE , $ this ->_logger );
702+ if (!is_null ($ variableValue )) {
703+ return VariableTypeUtils::castStringToType ($ variableValue , FeatureVariable::DOUBLE_TYPE , $ this ->_logger );
704704 }
705705
706- return $ variable_value ;
706+ return $ variableValue ;
707707 }
708708
709709 /**
@@ -718,14 +718,14 @@ public function getFeatureVariableDouble($featureFlagKey, $variableKey, $userId,
718718 */
719719 public function getFeatureVariableString ($ featureFlagKey , $ variableKey , $ userId , $ attributes = null )
720720 {
721- $ variable_value = $ this ->getFeatureVariableValueForType (
721+ $ variableValue = $ this ->getFeatureVariableValueForType (
722722 $ featureFlagKey ,
723723 $ variableKey ,
724724 $ userId ,
725725 $ attributes ,
726726 FeatureVariable::STRING_TYPE
727727 );
728728
729- return $ variable_value ;
729+ return $ variableValue ;
730730 }
731731}
0 commit comments