Code Duplication    Length = 13-13 lines in 2 locations

src/Service/ValidationService.php 2 locations

@@ 85-97 (lines=13) @@
82
     * @return string
83
     * @throws \Exception
84
     */
85
    public static function validateInputOnCreateUser($input)
86
    {
87
        if (!isset($input['name'])) {
88
            throw new \Exception(Messages::USER_NAME_REQUIRED, 400);
89
        }
90
        $name = self::validateName($input['name']);
91
        $email = null;
92
        if (isset($input['email'])) {
93
            $email = self::validateEmail($input['email']);
94
        }
95
96
        return ['name' => $name, 'email' => $email];
97
    }
98
99
    /**
100
     * Validate and sanitize input data when update a user.
@@ 131-143 (lines=13) @@
128
     * @return string
129
     * @throws \Exception
130
     */
131
    public static function validateInputOnCreateTask($input)
132
    {
133
        if (empty($input['task'])) {
134
            throw new \Exception(Messages::TASK_NAME_REQUIRED, 400);
135
        }
136
        $task = self::validateTaskName($input['task']);
137
        $status = 0;
138
        if (isset($input['status'])) {
139
            $status = self::validateStatus($input['status']);
140
        }
141
142
        return ['task' => $task, 'status' => $status];
143
    }
144
145
    /**
146
     * Validate and sanitize input data when update a task.