| @@ 102-114 (lines=13) @@ | ||
| 99 | * @return array |
|
| 100 | * @throws \Exception |
|
| 101 | */ |
|
| 102 | public function createTask($input) |
|
| 103 | { |
|
| 104 | $data = $this->validateInputOnCreateTask($input); |
|
| 105 | $repository = new TasksRepository; |
|
| 106 | $query = $repository->createTaskQuery(); |
|
| 107 | $statement = $this->database->prepare($query); |
|
| 108 | $statement->bindParam('task', $data['task']); |
|
| 109 | $statement->bindParam('status', $data['status']); |
|
| 110 | $statement->execute(); |
|
| 111 | $task = $this->checkTask($this->database->lastInsertId()); |
|
| 112 | ||
| 113 | return $task; |
|
| 114 | } |
|
| 115 | ||
| 116 | /** |
|
| 117 | * Update a task. |
|
| @@ 100-112 (lines=13) @@ | ||
| 97 | * @return array |
|
| 98 | * @throws \Exception |
|
| 99 | */ |
|
| 100 | public function createUser($input) |
|
| 101 | { |
|
| 102 | $data = $this->validateInputOnCreateUser($input); |
|
| 103 | $repository = new UsersRepository; |
|
| 104 | $query = $repository->createUserQuery(); |
|
| 105 | $statement = $this->database->prepare($query); |
|
| 106 | $statement->bindParam('name', $data['name']); |
|
| 107 | $statement->bindParam('email', $data['email']); |
|
| 108 | $statement->execute(); |
|
| 109 | $user = $this->checkUser($this->database->lastInsertId()); |
|
| 110 | ||
| 111 | return $user; |
|
| 112 | } |
|
| 113 | ||
| 114 | /** |
|
| 115 | * Update a user. |
|