Code Duplication    Length = 3-3 lines in 8 locations

src/app/controllers/contest.php 2 locations

@@ 26-28 (lines=3) @@
23
                'nick4',
24
            ], $errors);
25
26
            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number']) ) {
27
                $errors['contact_number'] = 'Please enter a valid phone number';
28
            }
29
30
            if (!empty($_POST['team_name']) && $this->contest_model->check_futsal_team_exists($_POST['team_name']) ) {
31
                $errors['team_name'] = 'This team name already exists';
@@ 95-97 (lines=3) @@
92
        $errors = [];
93
        if (!$user_details && $_SERVER['REQUEST_METHOD'] === 'POST') {
94
            required_post_params(['contact_number', 'paper_link'], $errors);
95
            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number']) ) {
96
                $errors['contact_number'] = 'Please enter a valid phone number';
97
            }
98
            if (!empty($_POST['paper_link']) && !is_valid_url($_POST['paper_link']) ) {
99
                $errors['paper_link'] = 'Please enter a valid link';
100
            }

src/app/controllers/ttt_workshop.php 1 location

@@ 48-50 (lines=3) @@
45
            required_post_params([
46
                'contact_number',
47
            ], $errors);
48
            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number']) ) {
49
                $errors['contact_number'] = 'Please enter a valid phone number';
50
            }
51
            if (!$errors) {
52
                $success = $this->model->register_for_ttt(
53
                    $user_nick,

src/app/controllers/artuino_workshop.php 1 location

@@ 67-69 (lines=3) @@
64
                'contact_number',
65
            ], $errors);
66
67
            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number']) ) {
68
                $errors['contact_number'] = 'Please enter a valid phone number';
69
            }
70
71
            if (!empty($_POST['team_name']) && $this->contest_model->check_artuino_team_exists($_POST['team_name']) ) {
72
                $errors['team_name'] = 'This team name already exists';

src/app/controllers/arvr_workshop.php 1 location

@@ 62-64 (lines=3) @@
59
        $errors = [];
60
        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
61
            required_post_params(['contact_number'], $errors);
62
            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number']) ) {
63
                $errors['contact_number'] = 'Please enter a valid phone number';
64
            }
65
            if (!$errors) {
66
                $user_details = [
67
                    'nick'              => $user_nick,

src/app/controllers/riderofstorms.php 1 location

@@ 62-64 (lines=3) @@
59
        $errors = [];
60
        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
61
            required_post_params(['name', 'leader', 'contact_number', 'members', 'link'], $errors);
62
            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number']) ) {
63
                $errors['contact_number'] = 'Please enter a valid phone number';
64
            }
65
            if (!empty($_POST['link']) && !is_valid_url($_POST['link']) ) {
66
                $errors['link'] = 'Please enter a valid link';
67
            }

src/app/controllers/webdev_workshop.php 1 location

@@ 62-64 (lines=3) @@
59
        $errors = [];
60
        if ($_SERVER['REQUEST_METHOD'] === 'POST') {
61
            required_post_params(['contact_number', 'stream', 'year', 'experience', 'why_join'], $errors);
62
            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number']) ) {
63
                $errors['contact_number'] = 'Please enter a valid phone number';
64
            }
65
            if (!$errors) {
66
                $user_details = [
67
                    'nick'              => $user_nick,

src/app/controllers/mun.php 1 location

@@ 64-66 (lines=3) @@
61
        $errors = [];
62
        if ($_SERVER['REQUEST_METHOD'] === 'POST' && !$user_details) {
63
            required_post_params(['contact_number', 'institute', 'team_size'], $errors);
64
            if (!empty($_POST['contact_number']) && !is_valid_phone_number($_POST['contact_number']) ) {
65
                $errors['contact_number'] = 'Please enter a valid phone number';
66
            }
67
            if (!ctype_digit($_POST['team_size'])) {
68
                $errors['team_size'] = 'Please enter a number';
69
            }