Skip to content

Commit

Permalink
Update builder registry interface
Browse files Browse the repository at this point in the history
  • Loading branch information
endroid committed Oct 21, 2024
1 parent 61cc3ef commit 08dc844
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
12 changes: 6 additions & 6 deletions src/Builder/BuilderRegistry.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ final class BuilderRegistry implements BuilderRegistryInterface
/** @var array<BuilderInterface> */
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));
}

return $this->builders[$name];
}

public function addBuilder(string $name, BuilderInterface $builder): void
{
$this->builders[$name] = $builder;
}
}
4 changes: 2 additions & 2 deletions src/Builder/BuilderRegistryInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

0 comments on commit 08dc844

Please sign in to comment.