Code Duplication    Length = 11-12 lines in 2 locations

src/Middleware/Authentication.php 1 location

@@ 92-102 (lines=11) @@
89
     * @param int $userId
90
     * @return AnonymusUserVO|UserVO
91
     */
92
    private function loadUser(int $userId) : UserVO
93
    {
94
        if ($userId > 0) {
95
            try {
96
                return $this->loadUser->loadUserById($userId);
97
            } catch (UserNotFoundException $e) {
98
            }
99
        }
100
101
        return new AnonymusUserVO();
102
    }
103
104
    /**
105
     * @param Request $request

src/Middleware/TokenAuthentication.php 1 location

@@ 92-103 (lines=12) @@
89
     * @param int $userId
90
     * @return AnonymusUserVO|UserVO
91
     */
92
    private function loadUser(int $userId) : UserVO
93
    {
94
        if ($userId > 0) {
95
            try {
96
                return $this->loadUser->loadUserById($userId);
97
            } catch (UserNotFoundException $e) {
98
                return new AnonymusUserVO();
99
            }
100
        } else {
101
            return new AnonymusUserVO();
102
        }
103
    }
104
}
105