EventListener/Login.php
private function getUser(TokenInterface $authenticationToken)
    {
        $user = $authenticationToken->getUser();

        if (is_string($user)) {
            return $user;
        } elseif (method_exists($user, 'getAPIUser')) {
            return $user->getAPIUser()->id;
        }

        return $authenticationToken->getUsername();
    }
private function getUser(TokenInterface $authenticationToken)
    {
        $user = $authenticationToken->getUser();

        if (is_string($user)) {
            return $user;
        } elseif (method_exists($user, 'getAPIUser')) {
            return $user->getAPIUser()->id;
        }

        return $authenticationToken->getUsername();
    }
private function getUser ( TokenInterface $ authenticationToken ) { $ user = $ authenticationToken -> getUser ( ) ; if ( is_string ( $ user ) ) { return $ user ; } elseif ( method_exists ( $ user , 'getAPIUser' ) ) { return $ user -> getAPIUser ( ) -> id ; } return $ authenticationToken -> getUsername ( ) ; }
Returns current username or ApiUser id.

@param TokenInterface $authenticationToken

@return int|string
Returns current username or ApiUser id .