container = $container; } public function getFunctions(): array { return [ new TwigFunction('ab_test_exists', [$this, 'exists']), new TwigFunction('ab_test', [$this, 'get']), new TwigFunction('ab_test_result', [$this, 'result']), new TwigFunction('ab_test_value', [$this, 'value']), ]; } public function exists(string $name): bool { return $this->container->has($name); } public function get(string $name): AbTest { return $this->container->get($name); } public function result(string $name): string { return $this->get($name)->getResult(); } public function value(string $name) { return $this->get($name)->getResultValue(); } }