From 39aa8530424310663c888f9e02224158961532e3 Mon Sep 17 00:00:00 2001 From: Marvin Borner Date: Tue, 30 Oct 2018 18:41:29 +0100 Subject: PHP is crap --- api/Users/Services/UserService.php | 88 -------------------------------------- 1 file changed, 88 deletions(-) delete mode 100644 api/Users/Services/UserService.php (limited to 'api/Users/Services/UserService.php') diff --git a/api/Users/Services/UserService.php b/api/Users/Services/UserService.php deleted file mode 100644 index 923acd0..0000000 --- a/api/Users/Services/UserService.php +++ /dev/null @@ -1,88 +0,0 @@ -auth = $auth; - $this->database = $database; - $this->dispatcher = $dispatcher; - $this->userRepository = $userRepository; - } - - public function getAll($options = []) - { - return $this->userRepository->get($options); - } - - public function getById($userId, array $options = []) - { - $user = $this->getRequestedUser($userId); - - return $user; - } - - public function create($data) - { - $user = $this->userRepository->create($data); - - $this->dispatcher->fire(new UserWasCreated($user)); - - return $user; - } - - public function update($userId, array $data) - { - $user = $this->getRequestedUser($userId); - - $this->userRepository->update($user, $data); - - $this->dispatcher->fire(new UserWasUpdated($user)); - - return $user; - } - - public function delete($userId) - { - $user = $this->getRequestedUser($userId); - - $this->userRepository->delete($userId); - - $this->dispatcher->fire(new UserWasDeleted($user)); - } - - private function getRequestedUser($userId) - { - $user = $this->userRepository->getById($userId); - - if (is_null($user)) { - throw new UserNotFoundException(); - } - - return $user; - } -} -- cgit v1.2.3