Knp\Bundle\KnpBundlesBundle\Security\Core\User\UserProvider::loadUserByOAuthUserResponse PHP Method

loadUserByOAuthUserResponse() public method

public loadUserByOAuthUserResponse ( HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface $response )
$response HWI\Bundle\OAuthBundle\OAuth\Response\UserResponseInterface
    public function loadUserByOAuthUserResponse(UserResponseInterface $response)
    {
        $findBy = array('name' => $response->getNickname(), 'githubId' => $response->getNickname());
        $user = $this->ownerManager->findDeveloperBy($findBy);
        if (!$user) {
            $user = $this->ownerManager->createOwner($findBy['name']);
            if (!$user) {
                throw new UsernameNotFoundException(sprintf('User with username "%s" could not found or created. If your account doesn\'t exists as github account, we can\'t connect you for now.', $findBy['name']));
            }
        }
        return $user;
    }