fixed something
This commit is contained in:
parent
b0d2aa93ab
commit
0b082549b9
|
|
@ -24,9 +24,12 @@ public static function resolve(string $key): DecisionEventHandler
|
||||||
{
|
{
|
||||||
$key = trim(strtolower($key));
|
$key = trim(strtolower($key));
|
||||||
$class = static::$map[$key] ?? null;
|
$class = static::$map[$key] ?? null;
|
||||||
if (! $class || ! class_exists($class)) {
|
if (! $class) {
|
||||||
throw new InvalidArgumentException("Unknown decision event handler for key: {$key}");
|
throw new InvalidArgumentException("Unknown decision event handler for key: {$key}");
|
||||||
}
|
}
|
||||||
|
if (! class_exists($class)) {
|
||||||
|
throw new InvalidArgumentException("Handler class {$class} for key {$key} does not exist (check autoload)");
|
||||||
|
}
|
||||||
$handler = app($class);
|
$handler = app($class);
|
||||||
if (! $handler instanceof DecisionEventHandler) {
|
if (! $handler instanceof DecisionEventHandler) {
|
||||||
throw new InvalidArgumentException("Handler for key {$key} must implement DecisionEventHandler");
|
throw new InvalidArgumentException("Handler for key {$key} must implement DecisionEventHandler");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user