Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- use ComCoreServiceImpl as Impl;
- class Load {
- public static function service(String $class, array $params = array()){
- try {
- $ucfirstclass = ucfirst($class);
- if (interface_exists('\Com\Core\Service\' . $ucfirstclass)) {
- $ref = "Impl\".$ucfirstclass;
- return new $ref();
- } else {
- throw new Exception("Service with name $class not found");
- }
- } catch (Throwable $ex) {
- echo $ex->getMessage();
- }
- }
- }
- $userService = Load::service("user");
- Class 'ImplUser' not found
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement