Code Duplication    Length = 14-14 lines in 2 locations

src/Service/UserService.php 1 location

@@ 78-91 (lines=14) @@
75
     * @return array
76
     * @throws \Exception
77
     */
78
    public function searchUsers($str)
79
    {
80
        $repo = new UserRepository;
81
        $stmt = $this->database->prepare($repo->searchUsersQuery());
82
        $name = '%' . $str . '%';
83
        $stmt->bindParam('name', $name);
84
        $stmt->execute();
85
        $users = $stmt->fetchAll();
86
        if (!$users) {
87
            throw new \Exception(MessageService::USER_NAME_NOT_FOUND, 404);
88
        }
89
90
        return $users;
91
    }
92
93
    /**
94
     * Create a user.

src/Repository/TaskRepository.php 1 location

@@ 63-76 (lines=14) @@
60
     * @return array
61
     * @throws \Exception
62
     */
63
    public function searchTasks($tasksName)
64
    {
65
        $query = TaskQuery::searchTasksQuery();
66
        $statement = $this->database->prepare($query);
67
        $query = '%' . $tasksName . '%';
68
        $statement->bindParam('query', $query);
69
        $statement->execute();
70
        $tasks = $statement->fetchAll();
71
        if (!$tasks) {
72
            throw new \Exception(MessageService::TASK_NOT_FOUND, 404);
73
        }
74
75
        return $tasks;
76
    }
77
78
    /**
79
     * Create a task.