@@ -111,6 +111,8 @@ class Optimizely
111
111
* @param $errorHandler ErrorHandlerInterface
112
112
* @param $skipJsonValidation boolean representing whether JSON schema validation needs to be performed.
113
113
* @param $userProfileService UserProfileServiceInterface
114
+ * @param $configManager ProjectConfigManagerInterface provides ProjectConfig through getConfig method.
115
+ * @param $notificationCenter NotificationCenter
114
116
*/
115
117
public function __construct (
116
118
$ datafile ,
@@ -119,20 +121,17 @@ public function __construct(
119
121
ErrorHandlerInterface $ errorHandler = null ,
120
122
$ skipJsonValidation = false ,
121
123
UserProfileServiceInterface $ userProfileService = null ,
122
- ProjectConfigManagerInterface $ configManager = null
124
+ ProjectConfigManagerInterface $ configManager = null ,
125
+ NotificationCenter $ notificationCenter = null
123
126
) {
124
127
$ this ->_isValid = true ;
125
128
$ this ->_eventDispatcher = $ eventDispatcher ?: new DefaultEventDispatcher ();
126
129
$ this ->_logger = $ logger ?: new NoOpLogger ();
127
130
$ this ->_errorHandler = $ errorHandler ?: new NoOpErrorHandler ();
128
131
$ this ->_eventBuilder = new EventBuilder ($ this ->_logger );
129
132
$ this ->_decisionService = new DecisionService ($ this ->_logger , $ userProfileService );
130
- $ this ->notificationCenter = new NotificationCenter ($ this ->_logger , $ this ->_errorHandler );
131
- $ this ->_projectConfigManager = $ configManager ;
132
-
133
- if ($ this ->_projectConfigManager === null ) {
134
- $ this ->_projectConfigManager = new StaticProjectConfigManager ($ datafile , $ skipJsonValidation , $ this ->_logger , $ this ->_errorHandler );
135
- }
133
+ $ this ->notificationCenter = $ notificationCenter ?: new NotificationCenter ($ this ->_logger , $ this ->_errorHandler );
134
+ $ this ->_projectConfigManager = $ configManager ?: new StaticProjectConfigManager ($ datafile , $ skipJsonValidation , $ this ->_logger , $ this ->_errorHandler );
136
135
}
137
136
138
137
/**
@@ -148,7 +147,7 @@ protected function getConfig()
148
147
/**
149
148
* Helper function to validate user inputs into the API methods.
150
149
*
151
- * @param $userId string ID for user.
150
+ * @param $attributes array Associative array of user attributes
152
151
* @param $eventTags array Hash representing metadata associated with an event.
153
152
*
154
153
* @return boolean Representing whether all user inputs are valid.
0 commit comments