| @@ 22-28 (lines=7) @@ | ||
| 19 | */ |
|
| 20 | public static function getInstance($handlerIdentifier) |
|
| 21 | { |
|
| 22 | foreach(config('dynamic-routing.handlers') as $handlerClass) { |
|
| 23 | $handlerMetadata = new ReflectionClass($handlerClass); |
|
| 24 | if($handlerIdentifier == $handlerMetadata->getShortName()) { |
|
| 25 | /** @var AbstractRouteTypeHandler $handler */ |
|
| 26 | return new $handlerClass(); |
|
| 27 | } |
|
| 28 | } |
|
| 29 | throw HandlerNotFoundException::fromIdentifier($handlerIdentifier); |
|
| 30 | } |
|
| 31 | ||
| @@ 39-44 (lines=6) @@ | ||
| 36 | */ |
|
| 37 | public static function handlerExists($handlerIdentifier) |
|
| 38 | { |
|
| 39 | foreach(config('dynamic-routing.handlers') as $handlerClass) { |
|
| 40 | $handlerMetadata = new ReflectionClass($handlerClass); |
|
| 41 | if($handlerIdentifier == $handlerMetadata->getShortName()) { |
|
| 42 | return true; |
|
| 43 | } |
|
| 44 | } |
|
| 45 | ||
| 46 | return false; |
|
| 47 | } |
|