public function getUser()
    {
        if (null === $token = $this->security->getToken()) {
            return null;
        }

        $user = $token->getUser();

        if (! is_object($user)) {
            return null;
        }

        return $user;
    }