Code Duplication    Length = 8-8 lines in 3 locations

src/User/Model.php 3 locations

@@ 56-63 (lines=8) @@
53
     *
54
     * @return static
55
     */
56
    public static function fromID($id)
57
    {
58
        if (! $user = get_user_by('id', $id)) {
59
            throw new UserNotFoundException("No user found with ID $id");
60
        }
61
62
        return new static($user);
63
    }
64
65
    /**
66
     * Create a new instance from the username.
@@ 92-99 (lines=8) @@
89
     *
90
     * @return static
91
     */
92
    public static function fromEmail($email)
93
    {
94
        if (! $user = get_user_by('email', $email)) {
95
            throw new UserNotFoundException("No user found with email address: $email");
96
        }
97
98
        return new static($user);
99
    }
100
101
    /**
102
     * Create a new instance from the user's slug.
@@ 110-117 (lines=8) @@
107
     *
108
     * @return static
109
     */
110
    public static function fromSlug($slug)
111
    {
112
        if (! $user = get_user_by('slug', $slug)) {
113
            throw new UserNotFoundException("No user found with slug: $slug");
114
        }
115
116
        return new static($user);
117
    }
118
119
    /**
120
     * Create a new instance using the currently authenticated user.