From d436f3866826ab2106442b6fb241e18a4d250aa7 Mon Sep 17 00:00:00 2001 From: Simon Vieille Date: Fri, 20 May 2022 18:39:42 +0200 Subject: [PATCH] refactoring of ab classes --- src/core/Ab/AbContainerInterface.php | 17 +++++++++++++++ src/core/Ab/AbTestInterface.php | 31 ++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 src/core/Ab/AbContainerInterface.php create mode 100644 src/core/Ab/AbTestInterface.php diff --git a/src/core/Ab/AbContainerInterface.php b/src/core/Ab/AbContainerInterface.php new file mode 100644 index 0000000..866b4fc --- /dev/null +++ b/src/core/Ab/AbContainerInterface.php @@ -0,0 +1,17 @@ + + */ +interface AbContainerInterface +{ + public function add(AbTestInterface $test): self; + + public function has(string $name): bool; + + public function get(string $name): AbTestInterface; +} diff --git a/src/core/Ab/AbTestInterface.php b/src/core/Ab/AbTestInterface.php new file mode 100644 index 0000000..051233e --- /dev/null +++ b/src/core/Ab/AbTestInterface.php @@ -0,0 +1,31 @@ + + */ +interface AbTestInterface +{ + public function getName(): string; + + public function getResult(); + + public function setResult(string $result): self; + + public function isValidVariation($variation): bool; + + public function addVariation(string $name, $value, int $probability = null): self; + + public function getVariation($variation); + + public function getResultValue(); + + public function setDuration(int $duration): self; + + public function getDuration(): int; + + public function run(): self; +}