@@ -34,6 +34,9 @@ class FeatureFlag
3434 protected bool $ _trackEventsFallthrough = false ;
3535 protected ?int $ _debugEventsUntilDate = null ;
3636 protected bool $ _clientSide = false ;
37+ protected ?int $ _samplingRatio = null ;
38+ protected bool $ _excludeFromSummaries = false ;
39+ protected ?MigrationSettings $ _migrationSettings = null ;
3740
3841 // Note, trackEvents and debugEventsUntilDate are not used in EventProcessor, because
3942 // the PHP client doesn't do summary events. However, we need to capture them in case
@@ -55,7 +58,10 @@ public function __construct(
5558 bool $ trackEvents ,
5659 bool $ trackEventsFallthrough ,
5760 ?int $ debugEventsUntilDate ,
58- bool $ clientSide
61+ bool $ clientSide ,
62+ ?int $ samplingRatio ,
63+ bool $ excludeFromSummaries ,
64+ ?MigrationSettings $ migrationSettings ,
5965 ) {
6066 $ this ->_key = $ key ;
6167 $ this ->_version = $ version ;
@@ -73,6 +79,9 @@ public function __construct(
7379 $ this ->_trackEventsFallthrough = $ trackEventsFallthrough ;
7480 $ this ->_debugEventsUntilDate = $ debugEventsUntilDate ;
7581 $ this ->_clientSide = $ clientSide ;
82+ $ this ->_samplingRatio = $ samplingRatio ;
83+ $ this ->_excludeFromSummaries = $ excludeFromSummaries ;
84+ $ this ->_migrationSettings = $ migrationSettings ;
7685 }
7786
7887 /**
@@ -82,8 +91,14 @@ public function __construct(
8291 */
8392 public static function getDecoder (): \Closure
8493 {
85- return fn ($ v ) =>
86- new FeatureFlag (
94+ return function ($ v ) {
95+ $ migrationSettings = null ;
96+
97+ if (is_array ($ v ['migration ' ] ?? null )) {
98+ $ migrationSettings = call_user_func (MigrationSettings::getDecoder (), $ v ['migration ' ]);
99+ }
100+
101+ return new FeatureFlag (
87102 $ v ['key ' ],
88103 $ v ['version ' ],
89104 $ v ['on ' ],
@@ -99,8 +114,12 @@ public static function getDecoder(): \Closure
99114 !!($ v ['trackEvents ' ] ?? false ),
100115 !!($ v ['trackEventsFallthrough ' ] ?? false ),
101116 $ v ['debugEventsUntilDate ' ] ?? null ,
102- !!($ v ['clientSide ' ] ?? false )
117+ !!($ v ['clientSide ' ] ?? false ),
118+ $ v ['samplingRatio ' ] ?? null ,
119+ !!($ v ['excludeFromSummaries ' ] ?? false ),
120+ $ migrationSettings ,
103121 );
122+ };
104123 }
105124
106125 public static function decode (array $ v ): self
@@ -192,4 +211,19 @@ public function getVersion(): int
192211 {
193212 return $ this ->_version ;
194213 }
214+
215+ public function getSamplingRatio (): int
216+ {
217+ return $ this ->_samplingRatio ?? 1 ;
218+ }
219+
220+ public function getExcludeFromSummaries (): bool
221+ {
222+ return $ this ->_excludeFromSummaries ;
223+ }
224+
225+ public function getMigrationSettings (): ?MigrationSettings
226+ {
227+ return $ this ->_migrationSettings ;
228+ }
195229}
0 commit comments