murph-core/src/core/Ab/AbContainer.php

31 lines
535 B
PHP
Raw Normal View History

2022-05-20 13:50:04 +02:00
<?php
namespace App\Core\Ab;
/**
* class AbContainer.
*
* @author Simon Vieille <simon@deblan.fr>
*/
2022-05-20 18:39:37 +02:00
class AbContainer implements AbContainerInterface
2022-05-20 13:50:04 +02:00
{
protected array $tests = [];
2022-05-20 18:39:37 +02:00
public function add(AbTestInterface $test): self
2022-05-20 13:50:04 +02:00
{
$this->tests[$test->getName()] = $test;
return $this;
}
public function has(string $name): bool
{
return isset($this->tests[$name]);
}
2022-05-20 18:39:37 +02:00
public function get(string $name): AbTestInterface
2022-05-20 13:50:04 +02:00
{
return $this->tests[$name];
}
}