From 08dc84458760cecbd49464cfcc181c9280257a7d Mon Sep 17 00:00:00 2001 From: Jeroen van den Enden Date: Mon, 21 Oct 2024 22:14:44 +0000 Subject: [PATCH] Update builder registry interface --- src/Builder/BuilderRegistry.php | 12 ++++++------ src/Builder/BuilderRegistryInterface.php | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Builder/BuilderRegistry.php b/src/Builder/BuilderRegistry.php index cf1449c3..13b9c96f 100644 --- a/src/Builder/BuilderRegistry.php +++ b/src/Builder/BuilderRegistry.php @@ -9,7 +9,12 @@ final class BuilderRegistry implements BuilderRegistryInterface /** @var array */ private array $builders = []; - public function getBuilder(string $name): BuilderInterface + public function set(string $name, BuilderInterface $builder): void + { + $this->builders[$name] = $builder; + } + + public function get(string $name): BuilderInterface { if (!isset($this->builders[$name])) { throw new \Exception(sprintf('Builder with name "%s" not available from registry', $name)); @@ -17,9 +22,4 @@ public function getBuilder(string $name): BuilderInterface return $this->builders[$name]; } - - public function addBuilder(string $name, BuilderInterface $builder): void - { - $this->builders[$name] = $builder; - } } diff --git a/src/Builder/BuilderRegistryInterface.php b/src/Builder/BuilderRegistryInterface.php index 048d6490..0d9fb379 100644 --- a/src/Builder/BuilderRegistryInterface.php +++ b/src/Builder/BuilderRegistryInterface.php @@ -6,7 +6,7 @@ interface BuilderRegistryInterface { - public function getBuilder(string $name): BuilderInterface; + public function set(string $name, BuilderInterface $builder): void; - public function addBuilder(string $name, BuilderInterface $builder): void; + public function get(string $name): BuilderInterface; }