| Conditions | 2 |
| Paths | 7 |
| Total Lines | 19 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 12 | public function createUser(array $data = []): int |
||
| 13 | { |
||
| 14 | $db = $this->getDI()->get('db'); |
||
| 15 | $db->begin(); |
||
| 16 | |||
| 17 | try { |
||
| 18 | $user = UserFactory::create($data); |
||
| 19 | $repository = new UserRepository($this->getDI()); |
||
| 20 | |||
| 21 | $userID = $repository->insertUserIntoDb($user); |
||
| 22 | $db->commit(); |
||
| 23 | |||
| 24 | $user->setUserId($userID); |
||
| 25 | |||
| 26 | return $user->getUserID(); |
||
| 27 | } catch (UserException $e) { |
||
| 28 | $db->rollback; |
||
| 29 | } |
||
| 30 | } |
||
| 31 | |||
| 48 |