Code Duplication    Length = 5-7 lines in 3 locations

app/Foundation/Security/AuthenticationManager.php 3 locations

@@ 99-103 (lines=5) @@
96
    public function preAuthentication()
97
    {
98
        foreach ($this->filterProviders('PreAuthenticationProviderInterface') as $provider) {
99
            if ($provider->authenticate() && $this->userProfile->initialize($provider->getUser())) {
100
                $this->dispatcher->dispatch(self::EVENT_SUCCESS, new AuthSuccessEvent($provider->getName()));
101
102
                return true;
103
            }
104
        }
105
106
        return false;
@@ 124-130 (lines=7) @@
121
            $provider->setUsername($username);
122
            $provider->setPassword($password);
123
124
            if ($provider->authenticate() && $this->userProfile->initialize($provider->getUser())) {
125
                if ($fireEvent) {
126
                    $this->dispatcher->dispatch(self::EVENT_SUCCESS, new AuthSuccessEvent($provider->getName()));
127
                }
128
129
                return true;
130
            }
131
        }
132
133
        if ($fireEvent) {
@@ 151-155 (lines=5) @@
148
    {
149
        $provider = $this->getProvider($name);
150
151
        if ($provider->authenticate() && $this->userProfile->initialize($provider->getUser())) {
152
            $this->dispatcher->dispatch(self::EVENT_SUCCESS, new AuthSuccessEvent($provider->getName()));
153
154
            return true;
155
        }
156
157
        $this->dispatcher->dispatch(self::EVENT_FAILURE, new AuthFailureEvent());
158