userClass = $userClass; $this->companyClass = $companyClass; $this->serviceClass = $serviceClass; $this->roleCompanyClass = $roleCompanyClass; $this->userGroup = $userGroup; $this->userGroupRole = $userGroupRole; } /** * @return CustomUserGroupRoleInterface * @throws \Exception */ public function getUserGroupRoleObject(){ $u = new $this->userGroupRole; if(!$u instanceof CustomUserGroupRoleInterface) throw new \Exception('Class Type Error : env(GROUP_ROLE_MODEL_CLASS) object is not a CustomUserGroupRoleInterface implementation'); return $u; } /** * Return current user::class * * @return null|string */ public function getUserGroupRoleClass(): ?string { return $this->userGroupRole; } /** * @return CustomUserGroupInterface * @throws \Exception */ public function getUserGroupObject(){ $u = new $this->userGroup; if(!$u instanceof CustomUserGroupInterface) throw new \Exception('Class Type Error : env(GROUP_MODEL_CLASS) object is not a CustomUserGroupInterface implementation'); return $u; } /** * Return current user::class * * @param bool $asNamespace * @return null|string */ public function getUserGroupClass(bool $asNamespace = true): ?string { if($asNamespace) return $this->userGroup; $path = explode('\\', $this->userGroup); return array_pop($path); } /** * @return CustomUserInterface * @throws \Exception */ public function getUserObject(){ $u = new $this->userClass; if(!$u instanceof CustomUserInterface) throw new \Exception('Class Type Error : env(USER_MODEL_CLASS) object is not a CustomUserInterface implementation'); return $u; } /** * Return current user::class * * @param bool $asNamespace * @return null|string */ public function getUserClass(bool $asNamespace = true): ?string { if($asNamespace) return $this->userClass; $path = explode('\\', $this->userClass); return array_pop($path); } /** * @return CustomCompanyInterface * @throws \Exception */ public function getCompanyObject(){ $u = new $this->companyClass; if(!$u instanceof CustomCompanyInterface) throw new \Exception('Class Type Error : env(COMPANY_MODEL_CLASS) object is not a CustomCompanyInterface implementation'); return $u; } /** * @param bool $asNamespace * @return null|string */ public function getCompanyClass(bool $asNamespace = true): ?string { if($asNamespace) return $this->companyClass; $path = explode('\\', $this->companyClass); return array_pop($path); } /** * @return CustomCompanyServiceInterface * @throws \Exception */ public function getServiceObject(){ $u = new $this->serviceClass; if(!$u instanceof CustomCompanyServiceInterface) throw new \Exception('Class Type Error : env(SERVICE_COMPANY_MODEL_CLASS) object is not a CustomCompanyServiceInterface implementation'); return $u; } /** * @param bool $asNamespace * @return null|string */ public function getServiceClass(bool $asNamespace = true): ?string { if($asNamespace) return $this->serviceClass; $path = explode('\\', $this->serviceClass); return array_pop($path); } /** * @return CustomCompanyUserRoleInterface * @throws \Exception */ public function getCompanyRoleObject(){ $u = new $this->roleCompanyClass; if(!$u instanceof CustomCompanyUserRoleInterface) throw new \Exception('Class Type Error : env(ROLE_COMPANY_MODEL_CLASS) object is not a CustomCompanyUserRoleInterface implementation'); return $u; } public function getCompanyRoleClass(){ return $this->roleCompanyClass; } }