| Conditions | 3 |
| Paths | 3 |
| Total Lines | 17 |
| Code Lines | 9 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function createService(ServiceLocatorInterface $serviceLocator) |
||
| 22 | { |
||
| 23 | $userService = $serviceLocator->get('zfcuser_auth_service'); |
||
| 24 | |||
| 25 | if (!$userService->hasIdentity()) { |
||
| 26 | throw new \InvalidArgumentException("User is not authenticated"); |
||
| 27 | } |
||
| 28 | |||
| 29 | $userSettingsRepository = $serviceLocator->get('JhFlexiTime\Repository\UserSettingsRepository'); |
||
| 30 | $userSettings = $userSettingsRepository->findOneByUser($userService->getIdentity()); |
||
| 31 | |||
| 32 | if (!$userSettings) { |
||
| 33 | throw new \InvalidArgumentException("User does not have a settings row"); |
||
| 34 | } |
||
| 35 | |||
| 36 | return $userSettings; |
||
| 37 | } |
||
| 38 | } |
||
| 39 |