plugin/website/Controller/Controller.php
protected function getLoggedUser()
    {
        $user = $this->get('security.token_storage')->getToken()->getUser();
        if (is_string($user)) {
            $user = null;
        }

        return $user;
    }
protected function getLoggedUser()
    {
        $user = $this->get('security.token_storage')->getToken()->getUser();
        if (is_string($user)) {
            $user = null;
        }

        return $user;
    }
protected function getLoggedUser ( ) { $ user = $ this -> get ( 'security.token_storage' ) -> getToken ( ) -> getUser ( ) ; if ( is_string ( $ user ) ) { $ user = null ; } return $ user ; }
Retrieve logged user. If anonymous return null.

@return user
Retrieve logged user . If anonymous return null .