-
-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
46 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?php | ||
|
||
namespace CuyZ\Valinor; | ||
|
||
interface InterfaceResolver | ||
{ | ||
public function resolve(string $interface, ?array $props) : ?string; | ||
|
||
public function getResolverProps(string $interface) : array; | ||
|
||
public function transform(object $input, callable $next) : array; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,6 +4,7 @@ | |
|
||
namespace CuyZ\Valinor; | ||
|
||
use CuyZ\Valinor\InterfaceResolver; | ||
use CuyZ\Valinor\Library\Container; | ||
use CuyZ\Valinor\Library\Settings; | ||
use CuyZ\Valinor\Mapper\ArgumentsMapper; | ||
|
@@ -530,6 +531,19 @@ public function registerTransformer(callable|string $transformer, int $priority | |
return $clone; | ||
} | ||
|
||
/** | ||
* @param string $factoryClass | ||
* @return void | ||
*/ | ||
public function withInterfaceResolver(InterfaceResolver $resolver): self | ||
Check failure on line 538 in src/MapperBuilder.php GitHub Actions / Quality Assurance
|
||
{ | ||
|
||
$clone = clone $this; | ||
$clone->settings->interfaceResolver = $resolver; | ||
|
||
return $clone->registerTransformer([$resolver, 'transform']); | ||
} | ||
|
||
/** | ||
* Warms up the injected cache implementation with the provided class names. | ||
* | ||
|