You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
689 B

3 years ago
  1. <?php
  2. namespace App\Handlers;
  3. /**
  4. *
  5. *
  6. *
  7. */
  8. abstract class Handler
  9. {
  10. /**
  11. *
  12. *
  13. * @param String $className
  14. * @return Mixed
  15. *
  16. */
  17. protected function getHandlerClass(String $className)
  18. {
  19. $result = NULL;
  20. // create class
  21. $class = 'App\\Handlers\\'.$className);
  22. // if not found check for custom handlers
  23. if (class_exists($class)) {
  24. $result = new $class();
  25. } else {
  26. // create class
  27. $class = 'CustomHandlers\\'.$className;
  28. if (class_exists($class)) {
  29. $result = new $class();
  30. }
  31. }
  32. return $result;
  33. }
  34. }