Advertisement
Guest User

Untitled

a guest
Jul 24th, 2017
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. use ComCoreServiceImpl as Impl;
  2.  
  3. class Load {
  4. public static function service(String $class, array $params = array()){
  5. try {
  6. $ucfirstclass = ucfirst($class);
  7. if (interface_exists('\Com\Core\Service\' . $ucfirstclass)) {
  8. $ref = "Impl\".$ucfirstclass;
  9. return new $ref();
  10. } else {
  11. throw new Exception("Service with name $class not found");
  12. }
  13. } catch (Throwable $ex) {
  14. echo $ex->getMessage();
  15. }
  16. }
  17. }
  18.  
  19. $userService = Load::service("user");
  20.  
  21. Class 'ImplUser' not found
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement