Code Duplication    Length = 17-17 lines in 2 locations

assets/lib/MODxAPI/modResource.php 1 location

@@ 258-274 (lines=17) @@
255
        return $value;
256
    }
257
258
    protected function findUserBy($data)
259
    {
260
        switch (true) {
261
            case (is_int($data) || ((int)$data > 0 && (string)intval($data) === $data)):
262
                $find = 'id';
263
                break;
264
            case filter_var($data, FILTER_VALIDATE_EMAIL):
265
                $find = 'email';
266
                break;
267
            case is_scalar($data):
268
                $find = 'username';
269
                break;
270
            default:
271
                $find = false;
272
        }
273
        return $find;
274
    }
275
276
    protected function getTime($value){
277
        $value = trim($value);

assets/lib/MODxAPI/modUsers.php 1 location

@@ 53-69 (lines=17) @@
50
     * @param $data
51
     * @return bool|string
52
     */
53
    protected function findUser($data)
54
    {
55
        switch (true) {
56
            case (is_int($data) || ((int)$data > 0 && (string)intval($data) === $data)):
57
                $find = 'attribute.internalKey';
58
                break;
59
            case filter_var($data, FILTER_VALIDATE_EMAIL):
60
                $find = 'attribute.email';
61
                break;
62
            case is_scalar($data):
63
                $find = 'user.username';
64
                break;
65
            default:
66
                $find = false;
67
        }
68
        return $find;
69
    }
70
71
    /**
72
     * @param $id