Skip to content

Commit

Permalink
Simplified ArchetypeResolve Initialization
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Wright <[email protected]>
  • Loading branch information
betterthanclay committed Nov 9, 2023
1 parent dfb2e32 commit 8b40ab7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
* Simplified ArchetypeResolve Initialization

## v0.2.20 (2023-11-08)
* Added unique option to register()
* Added getResolvers() and getNormalizers() to Handler
Expand Down
7 changes: 3 additions & 4 deletions src/Handler.php
Original file line number Diff line number Diff line change
Expand Up @@ -409,7 +409,9 @@ protected function ensureResolver(
string $interface
): void {
if (!isset($this->resolvers[$interface])) {
if (!$class = $this->resolve(Resolver::class, $interface)) {
if ($interface === Resolver::class) {
$class = ArchetypeResolver::class;
} elseif (!$class = $this->resolve(Resolver::class, $interface)) {
throw Exceptional::NotFound('Interface ' . $interface . ' has no Archetype resolver');
}

Expand All @@ -422,6 +424,3 @@ protected function ensureResolver(

// Register the Veneer facade
Veneer::register(Handler::class, Archetype::class);

// Load Archetype Resolver
Archetype::register(new ArchetypeResolver());

0 comments on commit 8b40ab7

Please sign in to comment.