HandlerResolverInterface.php 1.0 KB

12345678910111213141516171819202122232425262728
  1. <?php
  2. namespace Michel\PQueue\HandlerResolver;
  3. /**
  4. * Defines the contract for resolving a handler class string to an actual service instance.
  5. * This allows integration with DI containers and service locators.
  6. */
  7. interface HandlerResolverInterface
  8. {
  9. /**
  10. * Gets a handler instance from its class name.
  11. *
  12. * @param string $handlerClassName The fully qualified class name of the handler.
  13. * @return object The handler service instance.
  14. * @throws \Psr\Container\NotFoundExceptionInterface No handler was found for the given class name.
  15. * @throws \Psr\Container\ContainerExceptionInterface Error while retrieving the handler.
  16. */
  17. public function getHandler(string $handlerClassName): object;
  18. /**
  19. * Checks if a handler for the given class name is available.
  20. *
  21. * @param string $handlerClassName The fully qualified class name of the handler.
  22. * @return bool True if the handler is available, false otherwise.
  23. */
  24. public function hasHandler(string $handlerClassName): bool;
  25. }