Code Duplication    Length = 18-18 lines in 2 locations

api/v1/users.php 1 location

@@ 63-80 (lines=18) @@
60
    return true;
61
}
62
63
function validEmail($email)
64
{
65
    if(filter_var($email) === false)
66
    {
67
        return false;
68
    }
69
    $pos = strpos($email, '@');
70
    if($pos === false)
71
    {
72
        return false;
73
    }
74
    $domain = substr($email, $pos+1);
75
    if(checkdnsrr($domain, 'MX') === false)
76
    {
77
        return false;
78
    }
79
    return true;
80
}
81
82
function create_user()
83
{

test/UserTest.php 1 location

@@ 4-21 (lines=18) @@
1
<?php
2
//require_once(dirname(__FILE__).'/../api/v1/users.php');
3
4
function validEmail($email)
5
{
6
    if(filter_var($email) === false)
7
    {
8
        return false;
9
    }
10
    $pos = strpos($email, '@');
11
    if($pos === false)
12
    {
13
        return false;
14
    }
15
    $domain = substr($email, $pos+1);
16
    if(checkdnsrr($domain, 'MX') === false)
17
    {
18
        return false;
19
    }
20
    return true;
21
}
22
23
class UserTest extends PHPUnit_Framework_TestCase
24
{