@@ -111,6 +111,8 @@ class Optimizely
111111 * @param $errorHandler ErrorHandlerInterface
112112 * @param $skipJsonValidation boolean representing whether JSON schema validation needs to be performed.
113113 * @param $userProfileService UserProfileServiceInterface
114+ * @param $configManager ProjectConfigManagerInterface provides ProjectConfig through getConfig method.
115+ * @param $notificationCenter NotificationCenter
114116 */
115117 public function __construct (
116118 $ datafile ,
@@ -119,20 +121,17 @@ public function __construct(
119121 ErrorHandlerInterface $ errorHandler = null ,
120122 $ skipJsonValidation = false ,
121123 UserProfileServiceInterface $ userProfileService = null ,
122- ProjectConfigManagerInterface $ configManager = null
124+ ProjectConfigManagerInterface $ configManager = null ,
125+ NotificationCenter $ notificationCenter = null
123126 ) {
124127 $ this ->_isValid = true ;
125128 $ this ->_eventDispatcher = $ eventDispatcher ?: new DefaultEventDispatcher ();
126129 $ this ->_logger = $ logger ?: new NoOpLogger ();
127130 $ this ->_errorHandler = $ errorHandler ?: new NoOpErrorHandler ();
128131 $ this ->_eventBuilder = new EventBuilder ($ this ->_logger );
129132 $ 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 );
136135 }
137136
138137 /**
@@ -148,7 +147,7 @@ protected function getConfig()
148147 /**
149148 * Helper function to validate user inputs into the API methods.
150149 *
151- * @param $userId string ID for user.
150+ * @param $attributes array Associative array of user attributes
152151 * @param $eventTags array Hash representing metadata associated with an event.
153152 *
154153 * @return boolean Representing whether all user inputs are valid.
0 commit comments