PluginProbe ʕ •ᴥ•ʔ
WP STAGING – WordPress Backups, Restore, Migration & Clone / 4.10.0
WP STAGING – WordPress Backups, Restore, Migration & Clone v4.10.0
4.10.0 4.9.5 4.9.4 4.9.3 4.9.2 4.9.1 4.9.0 4.8.1 trunk 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.10.0 3.2.0 3.3.1 3.3.2 3.3.3 3.4.1 3.4.3 3.5.0 3.6.0 3.7.1 3.8.0 3.8.1 3.8.2 3.8.3 3.8.4 3.8.5 3.8.6 3.8.7 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4 4.0.0 4.1.0 4.1.1 4.1.2 4.1.3 4.1.4 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.0 4.7.0 4.7.1 4.7.2 4.7.3 4.8.0
wp-staging / Framework / Experiments / ExperimentsRegistry.php
wp-staging / Framework / Experiments Last commit date
Experiment.php 4 days ago ExperimentManager.php 4 days ago ExperimentsRegistry.php 4 days ago
ExperimentsRegistry.php
45 lines
1 <?php
2
3 namespace WPStaging\Framework\Experiments;
4
5 /**
6 * The list of A/B experiments WP STAGING knows about.
7 *
8 * Adding one means an entry here plus the surface that calls
9 * {@see ExperimentManager::getVariant()}. Retire one by flipping its third
10 * constructor argument to false rather than deleting the entry, so assigned
11 * installations keep reporting and past results stay analysable.
12 */
13 class ExperimentsRegistry
14 {
15 /** @var string First-run experience for new WP STAGING Free installations. */
16 const EXPERIMENT_FREE_ONBOARDING = 'free_onboarding_v1';
17
18 /** @var string Current first-run page, unchanged. */
19 const VARIANT_CONTROL = 'control';
20
21 /** @var string Dedicated "What would you like to do first?" action selector. */
22 const VARIANT_TASK_SELECTOR = 'task_selector';
23
24 /** @var Experiment[] Keyed by experiment id. */
25 private $experiments = [];
26
27 public function __construct()
28 {
29 $this->experiments[self::EXPERIMENT_FREE_ONBOARDING] = new Experiment(
30 self::EXPERIMENT_FREE_ONBOARDING,
31 [self::VARIANT_CONTROL, self::VARIANT_TASK_SELECTOR]
32 );
33 }
34
35 public function get(string $experimentId)
36 {
37 return isset($this->experiments[$experimentId]) ? $this->experiments[$experimentId] : null;
38 }
39
40 public function all(): array
41 {
42 return $this->experiments;
43 }
44 }
45