Code Duplication    Length = 15-15 lines in 2 locations

class/SwUserHandler.php 1 location

@@ 210-224 (lines=15) @@
207
        $link   = (preg_match('/avatars/i', $image)) ? XOOPS_UPLOAD_URL . '/' . $image : $image;
208
        $ext    = pathinfo(mb_strtolower($image), PATHINFO_EXTENSION);
209
210
        if (!in_array($ext, ['jpg', 'bmp', 'gif', 'png', 'jpeg']) || "" == $image || 'avatars/blank.gif' == $image) {
211
            switch ($gender) {
212
                case Constants::FEMALE:
213
                    $pict = 'ano_woman.png';
214
                    break;
215
                case Constants::MALE:
216
                    $pict = 'ano_man.png';
217
                    break;
218
                case Constants::GENDER_UNKNOWN:
219
                default:
220
                    $pict = 'genderless.png';
221
                    break;
222
            }
223
            $link = Helper::getInstance()->url("assets/images/{$pict}");
224
        }
225
        return $link;
226
    }
227
}

include/functions.php 1 location

@@ 523-537 (lines=15) @@
520
        $link = $image;
521
    }
522
523
    if (in_array($ext, ['jpg', 'bmp', 'gif', 'png', 'jpeg']) || '' == $image || 'blank.gif' == $image) {
524
        switch ($gender) {
525
            case Constants::FEMALE:
526
                $pict = 'ano_woman.png';
527
                break;
528
            case Constants::MALE:
529
                $pict = 'ano_man.png';
530
                break;
531
            case Constants::GENDER_UNKNOWN:
532
            default:
533
                $pict = 'genderless.png';
534
                break;
535
        }
536
        $link = Helper::getInstance()->url("assets/images/{$pict}");
537
    }
538
539
    return $link;
540
}